[Mono-dev] Need help with Sockets

Vorobiev Maksim MVorobiev at croc.ru
Tue Aug 16 02:54:45 EDT 2005

Good day.

You can try to tune keepalive TCP parameters. These parameters can be
setted via /proc file system. You can write values directly to
pseudo-files, set them with sysctl utility, or add them to
/etc/sysctl.conf. See man page for  sysctl for details.

Keepalive parameters that could be useful for your case are these:


For Suse Linux 9.2 they are setted as optimal for web-server:
net.ipv4.tcp_keepalive_intvl = 75 - how long to wait between to probes
for client alive (seconds)
net.ipv4.tcp_keepalive_probes = 9 - how many probes to send before idle
TCP connection force termination (units)
net.ipv4.tcp_keepalive_time = 7200 - how long to wait on idle connection
before check it for client alive (seconds)

BTW, same for Windows defaults are: 1/5/7200.

IMHO, you should change last parameter (2 hours) for something less. How
long is depend on how long your connections should be keeped idle and
how costly for you to open new connection.

-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Bernhard
Sent: Monday, August 15, 2005 12:45 PM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] Need help with Sockets


I have a Socket Server and Clients (see attached files). When
disconnecting the clients the server does not receive exceptions on some
of the clients. I have a cleanup routine that periodically checks the
clients by sending some empty data. But this does not work for some of
the clients (232 out of 360 connections are still "alive" on the server
after closing the clients).

Actually I created this client and server programs to test this

But this problem does not show in my simplified test programs, but it
does not work correctly nevertheless. The programs does work on MS .Net
(BTW: The socket client program does not work on Mono for Windows, maybe
this is the same problem that the MySql Connector is having on Windows
in -> but this is a different bug).

Maybe someone can have a look, I would really appreciate that. I have
not posted any bug reports yet (except for the one above). This is
really a major issue for me (kind of a show stopper). Maybe I am doing
something very wrong, I don't know. I am using on Suse Linux

Thank you

More information about the Mono-devel-list mailing list