Sponsored Content
Operating Systems AIX TCP/IP socket binding problem Post 302250567 by adiaconou on Thursday 23rd of October 2008 05:11:51 PM
Old 10-23-2008
TCP/IP socket binding problem

I have what appears to be a unique socket problem, although admittedly my tcp/ip programming experience is relatively limited.

I have a AIX server process using TCP/IP berkely sockets, and a Windows (C#) process. The windows process takes input from a user and sends a message to the Unix process to perform a system call.

If I kill the Unix process prematurely (ctrl-c), sometimes that socket is left bound to the port and the client has no idea that the process is dead. When I do a netstat -a | grep port, as long as I have the windows process running the connection to that socket is in ESTABLISHED state, and if I kill the windows process it goes to LISTENING state. It can take several hours (sometimes longer) for this socket to die, and obviously I cannot rebind. I have tried the setsockopt() with SO_REUSEADDR set, but I am still unable to re-bind to that port.

I've noticed that this ONLY happens if I have sent a message from the windows process since starting that windows process. If I start the windows process, connect to the unix server process, but don't send any messages, then I can kill and restart the unix process all day without the port getting stuck. Once the port gets stuck, it doesn't matter if I close the Windows process or not, there is nothing I can do to rebind to that port.

Is it possible there is some kind of cross-platform IP implementation conflict causing this to happen? A coworker set up a client-server echo program which sends data back and forth while regularly killing and restarting the server process. He has no problems with this, but it is only run on the AIX machine.
 

10 More Discussions You Might Find Interesting

1. Programming

Confusion about TCP/IP socket programming

Hello there chaps. First of all, i'm no TCP/IP-wiz, so forgive me if this is a stupid question. I've been messing around with filetransfer using sockets, and there is one thing that confuses me. This is how it's set up: A server app listens on a port for a client connection. When it... (3 Replies)
Discussion started by: crippe
3 Replies

2. UNIX for Dummies Questions & Answers

Which application has a TCP socket open

If I do a netstat -a I can see all the sockets currently open, is there a way that I can tell which application is holding open these sockets ? (3 Replies)
Discussion started by: murphyboy
3 Replies

3. Programming

problem receiving data from TCP socket

Hi all, I'm writing a socket program which sends a structure from one machine to another. When I run my client first time it runs well, however after the first time I couldn't receive all the data inside the structure (it is like, half of the array is received and the other half is not set). I... (1 Reply)
Discussion started by: SaTYR
1 Replies

4. Programming

Problem with socket binding - "system" call

Hi, I am having an issue with using sockets. I have a program which binds to a socket and listen on it. Later I spawn a thread to handle some function. In the new thread created I need to call a shell script which executes the specified function. Here I am using a system command to call the... (5 Replies)
Discussion started by: Janardhanbr
5 Replies

5. Programming

Using socket to test a TCP port

Hello, I'm trying to write a small c application to test a tcp port. This works fine for the most part but the default timeout on the connect is very long. I have been reading many posts but and it looks like I need to set the socket to be non-blocking and poll for a result. I have been totally... (2 Replies)
Discussion started by: tjones1105
2 Replies

6. IP Networking

Packets sent from Linux TCP socket

Hello, Our software is using a TCP socket (AF_INET, SOCK_STREAM) to communicate with an Ethernet device. When we send a message, the message object writes itself in full onto the socket's stream buffer before the software invokes send() from socket.h. I'm still researching, but have 2... (1 Reply)
Discussion started by: bix_20002000
1 Replies

7. Shell Programming and Scripting

Read and write to tcp socket

Hello all, I have a requirement to read and write to a tcp socket from an HP-UX shell script. I see a /dev/tcp character device on my servers: crw-rw-rw- 1 root root 72 0x00004f Mar 28 18:37 /dev/tcp So I believe this is what I should use. The problem is that all the... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies

8. Solaris

Tcp Socket (Connection refused) to my server box

I installed a fresh copy of Solaris 7 and present up my ip and domain for my web services but when I try to connect to it I get the following error; TCPActiveOpen: connect failed tcp/192.168.1.148/7900: 146 (Connection refused). the port is open in my router but I don't no were to add it in... (5 Replies)
Discussion started by: Wpgn
5 Replies

9. Solaris

Installing TCP-MUX protocol socket help required.

I been looking for a good guide or some help on how to install and setup TCP-MUX protocol socket on my Solaris 7 servers. Can anyone point me in right direction of help me ? Thanks (5 Replies)
Discussion started by: Wpgn
5 Replies

10. AIX

How to repair a TCP/IP socket in state: CLOSE_WAIT?

Hi The clients connect to my server -using port 9130. But no client could connect to my server at this time. I've checked already and this is the result netstat -Aan|grep -v 127.0.0.1|grep 9130|pg f10006000abcb398 tcp4 10313 0 10.0.89.81.9130 10.158.70.24.1705 CLOSE_WAIT... (8 Replies)
Discussion started by: bobochacha29
8 Replies
netx(8) 						      System Manager's Manual							   netx(8)

Name
       netx - TCP/IP net exerciser

Syntax
       /usr/field/netx [ -h ] [ -tn B ] [ -pm ] nodename

Description
       The  exerciser  sets  up a stream socket connection to the server in the TCP/IP internet domain. With connection made, the exerciser writes
       random data to the server; the server loops the data back to and the data is read and verified against the data written out.

       The exerciser runs in conjunction with the server.

       The exerciser by default will use the port number of the echo service in the file. Make sure that the TCP echo service is  enabled  in  the
       file  (no `#' in front of the service). The exerciser will run until or kill -15 pid is sent to the process.  The nodename is the remote or
       local system host name running the server.

Options
       The netx options are:

       -h	 Print the help message for the command.

       -tn	 Run time in minutes (n).  The default is to run until the process receives or kill -15 pid.

       -pm	 Specify port number to use in internet domain (m < 32768).  Note that this option is not used with  the  server,  so  you  should
		 never have to use this option.

Restrictions
       If  there  is  a need to run a system exerciser over an NFS link or on a diskless system, there are some restrictions.  For exercisers that
       need to write into a file system, such as the target file system must be writable by root.  Also the directory, in which any of	the  exer-
       cisers  are  executed,  must be writable by root because temporary files are written into the current directory.  These latter restrictions
       are sometimes difficult to overcome because often NFS file systems are mounted in a way that prevents root from writing into them.  Some of
       the restrictions may be overcome by copying the exerciser to another directory and then executing it.

Examples
       The following example exercises the TCP/IP network from the local host to node keel until a or kill -15 pid is received:
       % /usr/field/netx keel
       The following example exercises the TCP/IP network from the local host to node photon for 180 minutes in the background:
       % /usr/field/netx -t180 photon &

See Also
       Guide to System Exercisers

																	   netx(8)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy