.net - VB.Net socket communication, unusual data being received -


i trying communicate local as3 air app on pc via sockets. vb.net app acting server in case while air app client.

the .net app sends data every 25ms air app. have not send message termination. receive data on air app , process it.

on receiving side when debug data see that transitions have been concated.

something if send "abcdef" successively cases receive "abcdef" in cases receive "abcdefabcdef"

is possible underlying tcp network combining data , sending 1 packet. need send message terminator instance "abcdef$" , split messages @ receiving end?

am goofing big time?

from documentation socket.send:

there no guarantee data send appear on network immediately. increase network efficiency, underlying system may delay transmission until significant amount of outgoing data collected. successful completion of send method means underlying system has had room buffer data network send.


there's no guarantee you'll receive complete message @ receiving end either - how sockets work. i'd suggest adding "end of message" marker, , looping in receive code until receive complete message - may receive buffer straddles 2 messages, when you've got "end of message" marker, need keep hold of data received after point, use in reconstructing next message.

i.e. imagine have 2 messages receive - "aaaaaa" , "bbbbbbbb". might receive following 3 separate calls receive (after adding $ end of message marker):

aaaa aaaa$bb bbbbbb$ 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -