__connect_no_cancel blocks and server gets data out of order

I have a TCP server using select to get data from a client through TCP socket. The Server is slow in consuming data while the client is much faster. My client sends 8 bytes of data and each time it -open a new connection -write data -disconnect Because of this ( the server socket must accept many connection ) I increased the backlock value of listen to 500.

Despite this setting, at some point I can see that -my client blocks in a pthread function called __connect_nocancel and this happens many times. -after a while my server starts receiving data out of orders. The first data messed up is the one where the client blocks ( followed by other ).

I thought that increasing the backlog may fix this but this issue but this is not the case.

Can You help me? I am in Linux 2.6.32

Cheers

AFG

Answers


The backlog parameter of listen(2) is usually capped to some value inside the OS network stack. On Linux the default is 128.

The real problem though is, as @EJP is saying, you are totally mis-using TCP.


Need Your Help

iOS online High score with cocos2d

iphone ios cocos2d-iphone game-center

I have a simple game, and to save high-scores I wanted to do it both locally and globally. I know a bit about Game Center, but before getting into it, I was wondering if there were any other services

Page.Culture vs Thread.CurrentThread.CurrentCulture

c# asp.net razor webforms asp.net-webpages

I have been using Thread.CurrentThread.CurrentUICulture with System.Threading and System.Globalization, for a while now to manually set the language used by my ASP.net pages, mainly WebForms and We...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.