Help with socket!

  • Thread starter Thread starter Marty
  • Start date Start date
M

Marty

Hi,

I asked it previously but maybe I was not clear enough for having any
comments from you :)

When a socket is sending data, is there any test I have to do to be sure
that the outgoing packet is sent and I can trigger another sending of
messages?

Is it possible for a socket that has so much consecutive send, to loose
any of the messages it has to send?

Thank you
Marty
 
If you are using System.Net.Sockets there is a BeginSend and an EndSend
that you may use. I personaly cannot say I have had any problems with
losing packets or data even with some of the most robust network
applications. In your protocol you may wish to allocate part of your
header to ensure that packets are given an order. Also remember that
packets may be split up.
You may send 3 blocks of data and it might show up as 2 1/4 in one
packet and the remainging 3/4 in the second packet. Your application
needs to be able to handle this and reconstruct it. Once you have taken
care of that problem implemetning a simple numbering system in your
protocol header will ensure that you can tell when a packet is lost or
for some reason or another accidentally sent in the wrong order (if
possible).
 
Hi Marc,

Thank you for your reply.
You may send 3 blocks of data and it might show up as 2 1/4 in one
packet and the remainging 3/4 in the second packet. Your application
needs to be able to handle this and reconstruct it. Once you have taken
care of that problem implemetning a simple numbering system in your
protocol header will ensure that you can tell when a packet is lost or
for some reason or another accidentally sent in the wrong order (if
possible).

Yes, this I handle. Messages can but cut, so at the other end, the
client must keep in mind of the cutted part and save it.

But in the socket.send itself, do you think that this can be overrun?
and loose data?

I may do a test and send 1000 of messages in a loop and look at what the
client receive.

Regards,
Marty
 
Back
Top