VC ++ Sockets
There are 2 problems..If you have a solution please let me know.
in VC ++
1. If we are using AsyncSocket then we need to define the size of the buffer in which we receive the data from the socket. If we do not know the size of the data expected through the socket then what do we do and the size of data is larger than the buffer size.
2. Can we pass a parameter through a socket during connection request .That is connection time parameter ??how ??
# 1 Re: VC ++ Sockets
Answer to #1...
A TCP socket receives a stream of data with no beginning and no end. It is up to the sender to send something to tell the receiver how many bytes are in each message. If the sender sends 1000 bytes in one chunk, it might be received as 1000 messages of one byte each, or as 1000 bytes in one message. You have no control over this. Also, if the sender sends two 500 byte messages, they could be received as one message of 1000 bytes. Or, as one message of 250 bytes and one mesage of 750 bytes, etc. (But how many bytes your program gets at one time will be limited by the size of your buffer).
A UDP socket is different -- it will get a full messages in the same length as was sent, but delivery is not assured by the protocol. Lost UDP messages ("datagrams") are not considered an error.
Answer to #2...
I don't know.
# 2 Re: VC ++ Sockets
actually im ashamed to call it a solution say a getaround...
why dont u just accept the connection then send the time and let the decision to continue or not continue the connection be made?? the end result maybe the same... this u wud guessed already right... me typing this was unnecessary...:-)
Ganesh
Ganman at 2007-11-10 3:42:30 >
