Path: utzoo!attcan!utgpu!watmath!watdragon!rose!sekoppenhoef From: sekoppenhoef@rose.waterloo.edu Newsgroups: comp.unix.wizards Subject: socket communication problems Keywords: sockets SOCK_STREAM internet Message-ID: <16453@watdragon.waterloo.edu> Date: 17 Sep 89 15:48:33 GMT Sender: daemon@watdragon.waterloo.edu Distribution: na Lines: 34 Can anyone help me here? I thought that SOCK_STREAM type sockets were bidirectional in communication. Shouldn't I be able to read and write on BOTH ends of a socket connection? The following code is part of the client end. I want the client to get and receive info from a server. So *both* sides need to read and write. What am i doing wrong? sock = socket(AF_INET, SOCK_STREAM, 0); . . server.sin_family = AF_INET; hp = gethostbyname(argv[1]); . . bcopy( hp->h_addr, &server.sin_addr, hp->h_length); server.sin_port = htons(atoi(argv[2])); if (connect(sock, &server, sizeof(server)) < 0){ perror("connecting to stream socket"); exit(1); } **These two commands are what I'm using to write and read... the 'write' works **on the client end but not the read, and vice versa for the server end the server end uses an ACCEPT to get the scket name for communication of course. write(sock, buf, n) read(sock,buf,sizeof(buf) ) HELP!