LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Socket buffer size problem (https://www.linuxquestions.org/questions/programming-9/socket-buffer-size-problem-45176/)

slowman 02-13-2003 03:49 AM

Socket buffer size problem
 
I am programming a client-server model and have the need to send large amount of data. The client connects to the server, then selects a file to be transfered (like an ftp program) and the server sends it.

The problem is that I cant seem to send packets larger then 7 kbytes.... The client crashes just after recieved 2 packets. I am using this code to create a socket:

sock = socket(PF_INET, SOCK_STREAM, 0);

I have also tried to increase the socket buffer with the following:

setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &sock_buf, &sock_size);

sock_size is an integer currently set to 64000.

This is done with both the recieve and the send buffer on both the client and the server.

If anyone have any tips or suggestions please help me, anything at all is highly appreciated!!!!

trickykid 06-08-2003 12:30 PM

Moved: Seems to be more suitable in the Programming forum.

PTBmilo 06-08-2003 02:06 PM

where does it fail? did you check errno?

EDIT:
<I am running into a similar problem>
Are you sending some kind of small protocol-level messages? Maybe your getting hung up on a blocking read because your SENDQ/RECVQ are too big?

Maybe try using out-of-band packets for the messages?

I'm wondering which is better to do <for my app>:
1) pray that the packets get sent
2) toggle SEND/RECV-Q's every time control message sent (and possibley TCP_NODELAY?)
3) send out-of-band

maybe I'm way off track here.
comments?

Sorry for the ramble, but I think you might have the same issue.


All times are GMT -5. The time now is 07:44 AM.