Unix Programming - can a closed socket be re-connected?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > can a closed socket be re-connected?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author can a closed socket be re-connected?
Shea Martin

2004-01-23, 5:07 pm


I create a socket with socket(), then setsockopt(), then connect to
another machine using the socket. Then I close() the socket when I am done.

If I would like to connect to another node, or the same socket
descriptor, or do I have to get a new one from socket()... ?

I am on Solaris right now, but would like this to be portable to Linux.

Thanks,

~S

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

2004-01-23, 5:07 pm

Shea Martin <smartin@arcis.com> writes:
quote:

> I create a socket with socket(), then setsockopt(), then connect to
> another machine using the socket. Then I close() the socket when I am
> done.
>
> If I would like to connect to another node, or the same socket
> descriptor, or do I have to get a new one from socket()... ?



You have to create a new socket. You'll get EBADF if you don't.

--
Måns Rullgård
mru@kth.se
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com