PDA

Click to See Complete Forum and Search --> : need help on winsock control


chandrakari
Jun 22nd, 2007, 07:35 AM
hai,
using winsock control (UDP protocal) i am receiving data and processing. everything is ok when the datagram/packet size is small. but if the datagram/packet size is more like 10kb i am getting an error saying "the datagram is too big to fit into buffer...." how to solve this error. i cannot change the code on other side to reduce the datagram/packet size. if i have to increase the winsock control buffer size how to do that ? because the same data i am able to recive by a patch program written in VC. is it possible to use winsock api insted of winsock control? , if so how to call the api and what are the all api

thanking you

Pino
Jun 27th, 2007, 04:50 AM
You cant send packets over winsock that are too big. Keep your packets at like 2 - 5 kb (Thats the figure if i rmember correctly)

Then you send lots of packets and when they ahve all been sent the cleint re-builds the file.

Hope that helps

chandrakari
Jun 28th, 2007, 02:57 AM
if the transmit program is mine then i can do some thing. but here i can't do any thing. i have to receive the big block which is of 10k in size. is there any way to change default buffer size ( at present it is 8191 bytes). thank you

ccoder
Jun 28th, 2007, 08:42 AM
Based on the error message that you are getting, it sounds like you are having a Maximum Transmission Unit (MTU) issue. Here is a description of the MTU (http://en.wikipedia.org/wiki/Maximum_transmission_unit) and how it relates to packets, datagrams, etc.

You can find info on adjusting the MTU here (http://www.pctools.com/guides/registry/detail/280/) and here (http://help.expedient.net/broadband/mtu.shtml).

chandrakari
Jun 29th, 2007, 12:18 AM
thankyou very much for your reply.
My problem is i had a telemetry receiver(i can't do any changes to this ) which transmits the received data in blocks of 10 KB(10,245 is the block size) in LAN. in my receive program i opened a winsock control (UDP protocal) and trying to read it. i am getting an error saying "data gram is too large and it is truncated". if i am debugging no bytes read is showing 8191. this means it is reading only 8191 bytes trunkating remaining bytes. another thing is i am not facing any problem with the block size while transmission. the problem is only when i am receiving.so i am thinking that default buffer size is 8191 for reception. i need to read the whole block which is of 10245 bytes in size. so is there any way to solve this problem. by changing the MTU value will there won't be any other side effects?. insted of going to registry and change is there any API call avilable to change the buffer size for recption.

ccoder
Jun 29th, 2007, 09:40 AM
Ah, so you are seeing the error message on the receiving side. I guess that wasn't clear to me.

See if this MSDN link (http://support.microsoft.com/kb/237688) helps. Check out the info on setsockopt.