RE: [U2][UV] Forcing a port to close

2005-02-28 Thread James.E.Hogan
 If you've always used the flag, then CLOSE_WAIT makes no difference.
However, if you see a LOT  of connections in CLOSE_WAIT on your
 service port, then you should check your code. Something is definitely
not kosher with your 
 child processes.

I don't have a problem in my code. My email was simply to back up the
recommendation to use SO_REUSEADDR, given to Nick.

Thanks James
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-25 Thread Nick Cipollina
This is exactly what I am getting.  The process is stopped, but for
whatever reason, UniVerse is not closing and cleaning up the port.  The
program in question has LOGTO statements in it, and I think that it is
causing itself to get crossed up on the socket port.  If I include the
following statement, will it help:

X = setSocketOptions(SOCKETHANDLE, REUSEADDR : @VM : 1)

Thanks,
 
Nick Cipollina
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glen B
Sent: Thursday, February 24, 2005 6:13 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2][UV] Forcing a port to close

 This is a typical socket address condition that can't be safely
overridden by hand. If you look at your net stats, the socket in
question is probably in a CLOSE_WAIT state. This is a subsystem status
that says the remote has shutdown and it's waiting for the
socket to close and cleanup. If the socket gets dumped improperly by the
socket application, then the socket can be left in
CLOSE_WAIT with no process attached to finish cleanup. The status will
clear up, but it could take a long time. That all depends on
the tcp_close_wait setup and whether or not the socket is setup with the
SO_LINGER flag. If the socket's SO_REUSEADDR flag can be
enabled using some kind of U2 setsocketopt function before you listen
on it, then you can re-use the same socket address over and
over again.

Check out this sockets FAQ:
http://www.unixguide.net/network/socketfaq/


Glen
http://picksource.com
http://mvdevcentral.com

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Nick Cipollina
 Sent: Thursday, February 24, 2005 4:20 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2][UV] Forcing a port to close


 Is anyone aware of a way to force a socket port to close at the
 operating system level.  We are currently using Sun 9.xx.  We have a
 process that opens a port and accepts socket connections.  Whenever we
 stop it and try to restart it, we get a port in use message.  The only
 way that I've been able to get it to release the port is to stop and
 start universe again.  I'm just wondering if there is a way to force
the
 port to close.  Thanks.



 Nick Cipollina



 Pick Programmer

 ACS - Heritage Information Systems, Inc.

 2810 North Parham Road, Suite 210

 Richmond, VA 23294

 (804)644-8707 x 314
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-25 Thread Glen B
 Nick,

  I looked this up in the socket guide and the syntax is correct. The only real 
issue that can arise by enabling address re-use is
the slim possibility that partial data could be received into the socket 
buffer, from the sockets that were never shutdown down
properly. This can lead to confusion in the application and/or the socket 
subsystem. I've never had that issue occur, but the
possibility of the condition should be known.

Just for clarity in future reading, socket shutdown and close are not 
synonymous.
Close refers only to the release of a file handle. A handle can be closed and 
re-opened on the same socket address.
Shutdown refers to the releasing of the file handle and also the addresses used 
by the socket.

Glen
http://picksource.com
http://mvdevcentral.com

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Nick Cipollina
 Sent: Friday, February 25, 2005 8:29 AM
 To: u2-users@listserver.u2ug.org
 Subject: RE: [U2][UV] Forcing a port to close


 This is exactly what I am getting.  The process is stopped, but for
 whatever reason, UniVerse is not closing and cleaning up the port.  The
 program in question has LOGTO statements in it, and I think that it is
 causing itself to get crossed up on the socket port.  If I include the
 following statement, will it help:

 X = setSocketOptions(SOCKETHANDLE, REUSEADDR : @VM : 1)

 Thanks,

 Nick Cipollina

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Glen B
 Sent: Thursday, February 24, 2005 6:13 PM
 To: u2-users@listserver.u2ug.org
 Subject: RE: [U2][UV] Forcing a port to close

  This is a typical socket address condition that can't be safely
 overridden by hand. If you look at your net stats, the socket in
 question is probably in a CLOSE_WAIT state. This is a subsystem status
 that says the remote has shutdown and it's waiting for the
 socket to close and cleanup. If the socket gets dumped improperly by the
 socket application, then the socket can be left in
 CLOSE_WAIT with no process attached to finish cleanup. The status will
 clear up, but it could take a long time. That all depends on
 the tcp_close_wait setup and whether or not the socket is setup with the
 SO_LINGER flag. If the socket's SO_REUSEADDR flag can be
 enabled using some kind of U2 setsocketopt function before you listen
 on it, then you can re-use the same socket address over and
 over again.

 Check out this sockets FAQ:
 http://www.unixguide.net/network/socketfaq/


 Glen
 http://picksource.com
 http://mvdevcentral.com

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of Nick Cipollina
  Sent: Thursday, February 24, 2005 4:20 PM
  To: u2-users@listserver.u2ug.org
  Subject: [U2][UV] Forcing a port to close
 
 
  Is anyone aware of a way to force a socket port to close at the
  operating system level.  We are currently using Sun 9.xx.  We have a
  process that opens a port and accepts socket connections.  Whenever we
  stop it and try to restart it, we get a port in use message.  The only
  way that I've been able to get it to release the port is to stop and
  start universe again.  I'm just wondering if there is a way to force
 the
  port to close.  Thanks.
 
 
 
  Nick Cipollina
 
 
 
  Pick Programmer
 
  ACS - Heritage Information Systems, Inc.
 
  2810 North Parham Road, Suite 210
 
  Richmond, VA 23294
 
  (804)644-8707 x 314
  ---
  u2-users mailing list
  u2-users@listserver.u2ug.org
  To unsubscribe please visit http://listserver.u2ug.org/
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-25 Thread James.E.Hogan
setting  option SO_REUSEADDR, has a number of uses, one being that if
the listening gciserver is killed and there are still live connections,
a new server can be started. Without this option the system will return
error address already in use. 

This condition is typically encountered as follows:

a) a listening server is started
b) a connection request arrives and a child process is spawned to handle
that client
c) the listening server terminates but the child continues to service
the client on the existing connection
d) then an attempt is made to restart the listening server (will fail
with address already in use due to client connection)

SO_REUSEADDR also allows two listening servers to be started for the
same port no, but specifying different ip addresses (if hosts has
mulitple addresses). However we can still only start one server for each
ip address available to the machine

I have never heard of the shutdown issue mentioned below. I have been
writing socket applications for a long time and use SO_REUSEADDR and
have never come across this issue.

There are some other uses for RO_REUSEADDR which are quite advanced.

Reason why close my not shutdown a socket.

If a parent process and child process have a socket handle open. In the
case of the parent forgetting to do a close on the socket handle after
an accept call, then there will be two references to the same socket.
When the close is called by the child then the open reference counter on
the socket will be decremented but the socket will not be shutdown (as
the parent still has it open). The socket will only be shutdown if the
parent closes the socket too. This is a common mistake. However if the
code is corrected and the parent does close the socket, then when the
child calls close on the socket, there is only one reference count to
the socket then a close will shutdown the socket too.

James


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Glen B
Sent: 25 February 2005 14:28
To: u2-users@listserver.u2ug.org
Subject: RE: [U2][UV] Forcing a port to close


 Nick,

  I looked this up in the socket guide and the syntax is correct. The
only real issue that can arise by enabling address re-use is
the slim possibility that partial data could be received into the socket
buffer, from the sockets that were never shutdown down
properly. This can lead to confusion in the application and/or the
socket subsystem. I've never had that issue occur, but the
possibility of the condition should be known.

Just for clarity in future reading, socket shutdown and close are not
synonymous.
Close refers only to the release of a file handle. A handle can be
closed and re-opened on the same socket address.
Shutdown refers to the releasing of the file handle and also the
addresses used by the socket.

Glen
http://picksource.com
http://mvdevcentral.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-25 Thread James.E.Hogan
In my last message gciserver in the first line should have read simply
server.

James
Sungard
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-25 Thread Glen B
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of
 [EMAIL PROTECTED]
 Sent: Friday, February 25, 2005 11:32 AM
 To: u2-users@listserver.u2ug.org
 Subject: RE: [U2][UV] Forcing a port to close


 setting  option SO_REUSEADDR, has a number of uses, one being that if
 the listening gciserver is killed and there are still live connections,
 a new server can be started. Without this option the system will return
 error address already in use.

 This condition is typically encountered as follows:

 a) a listening server is started
 b) a connection request arrives and a child process is spawned to handle
 that client
 c) the listening server terminates but the child continues to service
 the client on the existing connection
 d) then an attempt is made to restart the listening server (will fail
 with address already in use due to client connection)

 SO_REUSEADDR also allows two listening servers to be started for the
 same port no, but specifying different ip addresses (if hosts has
 mulitple addresses). However we can still only start one server for each
 ip address available to the machine


 This is true.


 I have never heard of the shutdown issue mentioned below. I have been
 writing socket applications for a long time and use SO_REUSEADDR and
 have never come across this issue.


 Shutdown(in my terms) refers to the bi-directional termination of a TCP 
connection, not just the release of a socket handle. You
can also shutdown() a socket, but that only partially closes the socket. 
shutdown() blocks recv() functionality, while still
allowing send(). This is a great method of connection controlling that a lot of 
coders overlook. I didn't see it listed in the U2
sockets API, but it is available under most programming languages.

 If you've always used the flag, then CLOSE_WAIT makes no difference. However, 
if you see a LOT of connections in CLOSE_WAIT on your
service port, then you should check your code. Something is definitely not 
kosher with your child processes.

 There are some other uses for RO_REUSEADDR which are quite advanced.

 Reason why close my not shutdown a socket.

 If a parent process and child process have a socket handle open. In the
 case of the parent forgetting to do a close on the socket handle after
 an accept call, then there will be two references to the same socket.
 When the close is called by the child then the open reference counter on
 the socket will be decremented but the socket will not be shutdown (as
 the parent still has it open). The socket will only be shutdown if the
 parent closes the socket too. This is a common mistake. However if the
 code is corrected and the parent does close the socket, then when the
 child calls close on the socket, there is only one reference count to
 the socket then a close will shutdown the socket too.


 This also happens when a parent is killed by an interrupt and there is no 
interrupt handling in the application. The parent bails
without cleaning up and then waiting for the children to follow suit. Every 
child process gets set to CLOSE_WAIT. We are on the same
page, but I think I'm writing it in a different language. :P

 James



Glen
http://picksource.com
http://mvdevcentral.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2][UV] Forcing a port to close

2005-02-24 Thread karlp
quote who=Nick Cipollina
 Is anyone aware of a way to force a socket port to close at the
 operating system level.  We are currently using Sun 9.xx.  We have a
 process that opens a port and accepts socket connections.  Whenever we
 stop it and try to restart it, we get a port in use message.  The only
 way that I've been able to get it to release the port is to stop and
 start universe again.  I'm just wondering if there is a way to force the
 port to close.  Thanks.

I'm not sure this will help, but in Linux there's the /proc filesystem. In
that filesystem there's a file that represents everything that's going on.
Whenever I have a similar problem, I use fuser -k /proc/whatever/file and
that essentially 'closes' the process.

Karl




 Nick Cipollina



 Pick Programmer

 ACS - Heritage Information Systems, Inc.

 2810 North Parham Road, Suite 210

 Richmond, VA 23294

 (804)644-8707 x 314
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/



-- 
Karl L. Pearson
Director of IT,
ATS Industrial Supply
Direct: 801-978-4429
Toll-free: 800-789-9300 1,29
Fax: 801-972-3888
http://www.atsindustrial.com
[EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2][UV] Forcing a port to close

2005-02-24 Thread John Hester
[EMAIL PROTECTED] wrote:
I'm not sure this will help, but in Linux there's the /proc filesystem. In
that filesystem there's a file that represents everything that's going on.
Whenever I have a similar problem, I use fuser -k /proc/whatever/file and
that essentially 'closes' the process.
Karl
You can also reference the port directly with fuser.  This should work 
for other unixes in addition to linux.  For example, fuser -k telnet/tcp 
would kill all the telnet daemon processes, fuser -k 5100/upd would kill 
whatever's listening on udp port 5100.  The default fuser kill signal is 
SIGKILL (9), which might not be the most desirable way to terminate the 
process.  On linux you can specify a different kill signal (like 15) 
with the fuser -signal option.  On unix you might want to use fuser to 
determine the process ID, then use kill to get rid of it.

-John
--
John Hester
System  Network Administrator
Momentum Group Inc.
(949) 833-8886 x623
http://memosamples.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2][UV] Forcing a port to close

2005-02-24 Thread Glen B
 This is a typical socket address condition that can't be safely overridden by 
hand. If you look at your net stats, the socket in
question is probably in a CLOSE_WAIT state. This is a subsystem status that 
says the remote has shutdown and it's waiting for the
socket to close and cleanup. If the socket gets dumped improperly by the socket 
application, then the socket can be left in
CLOSE_WAIT with no process attached to finish cleanup. The status will clear 
up, but it could take a long time. That all depends on
the tcp_close_wait setup and whether or not the socket is setup with the 
SO_LINGER flag. If the socket's SO_REUSEADDR flag can be
enabled using some kind of U2 setsocketopt function before you listen on it, 
then you can re-use the same socket address over and
over again.

Check out this sockets FAQ:
http://www.unixguide.net/network/socketfaq/


Glen
http://picksource.com
http://mvdevcentral.com

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Nick Cipollina
 Sent: Thursday, February 24, 2005 4:20 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2][UV] Forcing a port to close


 Is anyone aware of a way to force a socket port to close at the
 operating system level.  We are currently using Sun 9.xx.  We have a
 process that opens a port and accepts socket connections.  Whenever we
 stop it and try to restart it, we get a port in use message.  The only
 way that I've been able to get it to release the port is to stop and
 start universe again.  I'm just wondering if there is a way to force the
 port to close.  Thanks.



 Nick Cipollina



 Pick Programmer

 ACS - Heritage Information Systems, Inc.

 2810 North Parham Road, Suite 210

 Richmond, VA 23294

 (804)644-8707 x 314
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/