How to handle unplugging ethernet cable in socket programming
Hi, I am trying to implement a server-client socket communication. My server and clients are in different PCs. During communications if the ethernet cable is removed from the server side it shows broken pipe due to unable to write on the socket. I want to know how to check whether the ethernet cable is plugged or not before trying to write on socket. Is there any API to check ethernet connectivity that can be used in socket programming?? How can I check a socket is alive or not ??
Last edited by JagadishB; 02-19-2010 at 01:19 AM..
Hello,
Is there any API or any other approach to detect whether the network cable is connected to the network adapter, say, en0, en1 or en2?
The OS is AIX6.1.
Thank you. (4 Replies)
Hi,
I want to code TCP/IP client/server in linux application capable to fastly detect ethernet cable disconnection in any condition.
So I have activate SO_KEEPALIVE options and set TCP_KEEPCNT, TCP_KEEPIDLE and TCP_KEEPINTVL to 1.
When I disconnect ethernet cable I have the following... (5 Replies)
Hi everyone,
I'm new to this forum. I'm working on new project for last few days and this forum already helped me on
couple of occasions. I don't have any prior experience with network programming so I'll appreciate any advise given.
I'm trying to do the following:
1. open user... (2 Replies)
Hi,
I'm trying to communicate two servers (HP DLProliant 380 G5) via a crossover cable, but I don't get them to ping each other.
I am working in RHEL 4.
These are the steps I've performed:
1) Plugged the crossover cables in eth2.
(note: The cable is brand new. Also I built one myself... (3 Replies)
hi guys i got this code trying to make connection between the server and multi clients but when i do ./server i got message server waiting then when i run ./client it says client 1 nosuch file i dont know whats that should i use any argument plz help how to compile and run and whats the expected... (1 Reply)
Hi ,
I'm facing the following problem in socket programming.
My structure is
struct {
int i;
char *str;
}samp;
I'm creating the pointer to this structure and assigning the value to the structure members and send via the socket to the another process.
The receiver process when... (7 Replies)
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
DBENCH(1) General Commands Manual DBENCH(1)NAME
dbench - Measure disk throughput for simulated netbench run
SYNOPSIS
dbench [options]numclients
tbench [options]numclientsserver tbench_srv [options]
DESCRIPTION
This manual page documents briefly the dbench and tbench benchmarks. This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page. However, it has fairly easy to read source code.
Netbench is a terrible benchmark, but it's an "industry standard" and it's what is used in the press to rate windows fileservers like Samba
and WindowsNT.
Given the requirements of running netbench (60 and 150 Windows PCs all on switched fast ethernet and a really grunty server, and some way
to nurse all those machines along so they will run a very fussy benchmark suite without crashing), these programs were written to open up
netbench to the masses.
Both dbench and tbench read a load description file called client.txt that was derived from a network sniffer dump of a real netbench run.
client.txt is about 4MB and describes the 90 thousand operations that a netbench client does in a typical netbench run. They parse
client.txt and use it to produce the same load without having to buy a huge lab.
dbench produces only the filesystem load. It does all the same IO calls that the smbd server in Samba would produce when confronted with a
netbench run. It does no networking calls.
tbench produces only the TCP and process load. It does the same socket calls that smbd would do under a netbench load. It does no filesys-
tem calls. The idea behind tbench is to eliminate smbd from the netbench test, as though the smbd code could be made infinately fast.
OPTIONS
The dbench program takes a number, which indicates the number of clients to run simultaneously. It can also take the following options:
-c client.txt
Use this as the full path name of the client.txt file (the default is /usr/share/dbench/client.txt).
-s Use synchronous file IO on all file operations.
-t TIME
set the runtime of the benchmark in seconds (default 600)
-D DIR set the base directory to run the filesystem operations in
-x enable xattr support, simulating the xattr operations Samba4 would need to perform to run the load
-S Use synchronous IO for all directory operations (unlink, rmdir, mkdir and rename).
The tbench program takes a number, which indicates the number of clients to run simultaneously, and a server name: tbench_srv should
be invoked on that server before invoking tbench. tbench can also take the following options:
-T option[,...]
This sets the socket options for the connection to the server. The options are a comma-separated list of one or more of the follow-
ing: SO_KEEPALIVE, SO_REUSEADDR, SO_BROADCAST, SO_NODELAY, SO_LOWDELAY, SO_THROUGHPUT, SO_SNDBUF=number, SO_RCVBUF=number, SO_SND-
LOWAT=number, SO_RCVLOWAT=number, SO_SNDTIMEO=number,and SO_RCVTIMEO=number. See socket(7) for details about these options.
The tbench_srv can only take one option: -T option[,...] as documented above.
SEE ALSO
/usr/share/doc/dbench/README contains the original README by Andrew Tridgell which accompanies the dbench source.
AUTHOR
This manual page was originally written by Paul Russell <prussell@alderaan.franken.de>, for the Debian GNU/Linux system (but may be used by
others). Modified and updated by Mattias Nordstrom <nordstrom@realnode.com>.
June 18, 2005 DBENCH(1)