S
Simon Says
Hi all,
I've a message object that is serialized to a xml string and communicating
between a client and server with a connection-oriented (TCP) socket. Unlike
a UDP, in a TCP socket, the 'Receive' function will try to read in as much
data as possible from the buffer and return, and therefore, sometimes the
message isn't complete with just one 'Receive' call.
In order to make sure that my message is complete, I've added in a 'STX' and
'EOT' into my xml string just to make sure that whether if more than 1
'Receive' call is needed to complete the message. It definitely works, but
I'm just wondering if there is any other smarter way of doing it? Is it
possible do it like the UDP's 'receivefrom' function where it will only
return when the whole datagram is received? I'm using VS2005 now, any new
tricks?
Thanks,
Simon
I've a message object that is serialized to a xml string and communicating
between a client and server with a connection-oriented (TCP) socket. Unlike
a UDP, in a TCP socket, the 'Receive' function will try to read in as much
data as possible from the buffer and return, and therefore, sometimes the
message isn't complete with just one 'Receive' call.
In order to make sure that my message is complete, I've added in a 'STX' and
'EOT' into my xml string just to make sure that whether if more than 1
'Receive' call is needed to complete the message. It definitely works, but
I'm just wondering if there is any other smarter way of doing it? Is it
possible do it like the UDP's 'receivefrom' function where it will only
return when the whole datagram is received? I'm using VS2005 now, any new
tricks?
Thanks,
Simon