|
-
September 7th, 2006, 12:39 PM
#1
message lengths Winsock2 TCp/Ip
hi,
are there any general guidlines for the size of a message that should be send over TCP/Ip using winsock2. e.g I have a structue of max size 3461760 bytes. Can be be sent over tcp/ip as a message to an application as one single message.
What are the issues with using recv ( winsock2 ) and datalengths, if there are any.
Can anyone point me to a an article which can explain this. I am new to network programmign basically with zero training and have to research on my own to write a set of network applications.
Thnx for help.
-
September 7th, 2006, 01:53 PM
#2
Re: message lengths Winsock2 TCp/Ip
Interesting.
check out getsockopt() and SO_SNDBUF. i read something about 8192 default buffer size
Kuphryn
-
September 7th, 2006, 03:26 PM
#3
Re: message lengths Winsock2 TCp/Ip
isn't this one for unix thou? all the articles abt it mention unix. My apps are gonan run on windows and use winsock2
-
September 7th, 2006, 03:29 PM
#4
Re: message lengths Winsock2 TCp/Ip
sorry yeah it is for winsock too.
Okie let's assume that the data i wanna send is larger then that value. How do you deal witht his kinda thing when the message is recieved by client/server? am tempted to use recv( well dunno abt anything else )
-
September 8th, 2006, 12:47 AM
#5
Re: message lengths Winsock2 TCp/Ip
 Originally Posted by venAdder
are there any general guidlines for the size of a message that should be send over TCP/Ip using winsock2. e.g I have a structue of max size 3461760 bytes. Can be be sent over tcp/ip as a message to an application as one single message.
yes, the buffer can be sent all at once, with one call to send(). This is a simple technique usable when there is only one (or, at most a few) transmissions, such as between a single server and a single client.
This approach does not scale well, however, if there are many transmission (or many clients being served), since then you must allocate many large-sized buffers. so, in this case, one approach is to break the transmission into blocks of reasonable size, and send only one block at a time. The definition of "reasonable" will vary based on your specific application. Frequently-used numbers are 4k and 8k.
 Originally Posted by venAdder
What are the issues with using recv ( winsock2 ) and datalengths, if there are any.
Same issue as above (memory allocation for the receive buffer), plus another: responsiveness. If you try to receive one single huge buffer, then you will typically wait until the entire buffer is received, which might take a long time during which nothing else happens. On the other hand, if you receive multiple smaller buffers, then at least something is happening periodically, such as the accumulation of a received file to permanent storage on a disk.
 Originally Posted by venAdder
Can anyone point me to a an article which can explain this. I am new to network programmign basically with zero training and have to research on my own to write a set of network applications.
Thnx for help.
I listed a few links at your other post.
Mike
-
September 11th, 2006, 02:25 PM
#6
Re: message lengths Winsock2 TCp/Ip
Thanx Mike, it did help me a lot , I am gonan keep exploring into this till i get it all straightened out . Thnx again for you help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|