slow socket response

kcarey

New member
Joined
Jun 28, 2005
Messages
2
Programming Experience
Beginner
Hello,

I'm having a performance issue with tcp sockets in .net verus winsock .

Here's my application : I have a vb.net app listening for connections from a device. The device connects to the vb.net app, sends a string and waits 100ms for a response from the vb.net app. If the response does not arrive in 100ms the device stops a motor.

I've tried a few different way in .net but i can't seem to get a steady response back in under 100 ms. I wrote a similar app in VB6 using winsock and it works very well. VB6 is not an option however.

In my Vb.net app i have a thread with calls tcpSocket = tcpListener.AcceptSocket() . On connection i simply send a string "ACK" back over the tcpSocket. I then close the tcpSocket .

Something strange i've noticed is that it works every second time the device connects. But with winsock it works perfectly all the time.

The vb.net works fine if the device waits for 500ms but this is not acceptable.

I've also tried using an asynchronious listener but i have the same problem.

Surely sockets in .net are not slower than an old winsock control ?

Any idea as to what i'm doing wrong?

Thanks .
 
Back
Top