tobjectpascal
asked on
Yahoo Messenger/MSN Messenger/etc etc Clone
Hey folks, i'm writing a Server and Messenger client, it works fine and all, and it supports 800 users at the same time to talk to each other, but i have a small problem regarding winsock..
when you get "lagged" delayed, winsock sends in packets on top of each other so the user sends..
123CRLF
456CRLF
789CRLF
the Server should get packets like
123CRLF
456CRLF
and so on, but when it's lagged htis happens
123CRLF456CRLF789CRLF
all in the one packet, so what i do is split the packets up by doing something like while (CRLF,Packet)>0 .... get start to crlf, chop it out and then get the next packet..
is there anyway of instructing winsock to not do that? i can't find any references...
http://daynacommunications.com/sprt/sprtscreenshot.gif <<is the messenger program
http://daynacommunications.com/sprtmessenger.zip
If anyone wants to try it, my ID is Craig, i have it online, it's free of course but if you like it and you want to help me or give me suggestions for it, other than the problem i mentioned above which will have to be solved in here of course... feel free to IM me simply click on the ADD icon and type in Craig a smiley face will appear if i'm online.
when you get "lagged" delayed, winsock sends in packets on top of each other so the user sends..
123CRLF
456CRLF
789CRLF
the Server should get packets like
123CRLF
456CRLF
and so on, but when it's lagged htis happens
123CRLF456CRLF789CRLF
all in the one packet, so what i do is split the packets up by doing something like while (CRLF,Packet)>0 .... get start to crlf, chop it out and then get the next packet..
is there anyway of instructing winsock to not do that? i can't find any references...
http://daynacommunications.com/sprt/sprtscreenshot.gif <<is the messenger program
http://daynacommunications.com/sprtmessenger.zip
If anyone wants to try it, my ID is Craig, i have it online, it's free of course but if you like it and you want to help me or give me suggestions for it, other than the problem i mentioned above which will have to be solved in here of course... feel free to IM me simply click on the ADD icon and type in Craig a smiley face will appear if i'm online.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Should have also elaborated...
> "Tcp sockets are a streaming type connection"
should be
> "Tcp sockets are a streaming BYTE type connection." Meaning, tcp has no notion of a message oriented connection
Russell
> "Tcp sockets are a streaming type connection"
should be
> "Tcp sockets are a streaming BYTE type connection." Meaning, tcp has no notion of a message oriented connection
Russell
ASKER
Often programmers seem to assume that if Program A sends a "chunk" via TCP, receiving Program B will receive precisely one DataArrival event and precisely that one "chunk" of data will be retrieved by calling GetData.
This can be true in many cases, most of the time.
It is nearly true if:
most Winsock parameters are left at their default values,
"chunks" of between (approximately) 500 to 1000 bytes are transmitted,
the programs at each end are either slow, or the sender waits for a "reply" to each "chunk" before sending a new "chunk."
The Winsock parameters must mostly be set via the Winsock API, not directly through Winsock control properties.
One of the largest factors in all of this though is that network elements may change the chunking. Winsock itself defaults to Nagling which is a process used to combine several very small "chunks" into one "chunk" before it gets out of the sender's TCP/IP protocol stack. Routers and bridges in the path can re-chunk the data. The receiving TCP/IP stack can re-chunk the data into fewer or more "chunks" before your VB program will ever see it.
ok that's what i'm refering to then what's known as "chunking"