Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-13-2003, 04:49 AM   #1
LQ Newbie
Registered: Feb 2003
Posts: 2

Rep: Reputation: 0
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!!!!
Old 06-08-2003, 01:30 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 257Reputation: 257Reputation: 257
Moved: Seems to be more suitable in the Programming forum.
Old 06-08-2003, 03:06 PM   #3
Registered: Jan 2003
Posts: 167

Rep: Reputation: 30
where does it fail? did you check errno?

<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.

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

Last edited by PTBmilo; 06-08-2003 at 05:10 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Pipe Buffer size traku Linux - Newbie 1 10-23-2009 08:48 AM
socket buffer TCP lucs Slackware 0 05-05-2005 08:26 AM
Data buffer size MarcReing Programming 7 10-21-2004 01:51 PM
Squid: "Socket error... (55) no buffer space available J_Szucs Linux - Networking 1 08-30-2004 09:10 AM
CD write buffer size rch Linux - General 1 09-26-2003 06:50 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration