Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!hplabsc!jin From: jin@hplabsc.UUCP (Tai Jin) Newsgroups: comp.sys.hp Subject: Re: Socket stuff Message-ID: <2053@hplabsc.UUCP> Date: Thu, 18-Jun-87 23:35:13 EDT Article-I.D.: hplabsc.2053 Posted: Thu Jun 18 23:35:13 1987 Date-Received: Mon, 22-Jun-87 01:25:19 EDT References: <6644@shemp.UCLA.EDU> <2032@hplabsc.UUCP> <6743@shemp.UCLA.EDU> Reply-To: jin@hplabsc.UUCP (Tai Jin) Distribution: world Organization: Hewlett-Packard Labs, Palo Alto, CA Lines: 24 Keywords: socket, IPC In article <6743@shemp.UCLA.EDU> kong@CS.UCLA.EDU (Kong Li) writes: >The problem occurs when two processes on the HP try to communicate with >each other by socket (NOT between the HP and the intel System 310 :-), actually >the connection between the HP and the intel System 310 is successful). > dsoc = socket(AF_INET,SOCK_STREAM,0); > ... > setsockopt(dsoc, SOL_SOCKET, SO_REUSEADDR,...); > ... > connect(dsoc, (struct *)&his_addr, sizeof(his_addr)); > ... >but the connection fails. The errno tells me "Connection refused". >But the same code works on the VAX BSD 4.3, any clues ? I assume the peer process did a corresponding socket(), bind(), listen(), accept() sequence. By the way, why do you do a setsockopt() on the connect socket? You normally do it on the bind socket. Unless there's a reason for it, remove it. Anyway, that errno tells me that the server wasn't listening on the particular port you were trying to connect to. After you've started the server process, do a "netstat -a" to see if it's there. Make sure that the port and address in the "his_addr" struct are correct. ...tai