esr@mrst.UUCP (Eric S. Rose) (07/14/87)
Hello there.... Can anyone help me with a problem involving sockets? I have a simple server/client program where the server could be present on any one of several machines on the Ethernet. If a client does a 'connect' to a machine that does not have the server, an error is returned ('ECONNREFUSED'). This is Ok, I'll try another. The next time I get another error, ('EINVAL') even though this time, it is trying to connect to the machine where the server really is. If I close the socket connection *after* the bad connection, re-open it, and try the connect on the new machine, it works fine. It seems that when connect fails, it changes some internal flags that need to be reset. Is there any way to make this not happen, or reset it? I also tried: setsockopt ( sock, SOL_SOCKET, SO_REUSEADDR, (char *)0, 0); As well as: x = 1; setsockopt ( sock, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); after the socket call and before the connect, but there was no difference. We don't have sources, and the documentation is pretty sketchy on these areas. Thanks in advance for any helpful hints.... Eric "Has anyone seen... | Eric Rose a dog dyed dark green?" | MRS Technology, Acton, MA. - B-52's | (617)264-4588 | ...genrad \ | >- !mrst!esr | ...necis /