Path: utzoo!utgpu!watmath!iuvax!khan From: khan@iuvax.cs.indiana.edu Newsgroups: comp.protocols.tcp-ip Subject: Bidirectional communication (HELP) Message-ID: <44500001@iuvax> Date: 9 Apr 89 20:24:00 GMT Organization: Indiana University CSCI, Bloomington Lines: 53 Nf-ID: #N:iuvax:44500001:000:1160 Nf-From: iuvax.cs.indiana.edu!khan Apr 9 15:24:00 1989 Can anyone tell me how to use bidirectional communication in UNIX tcp-ip, using STREAM sockets. I am trying to implement a CLIENT-SERVER model application. Here is what each of them successfully do: CLIENT: ... s = socket(AF_INT,SOCK_STREAM,0); if (s < 0) ... if (connect(s,(char *)&server, sizeof(server)) < 0) ... if (write(s,msg,strlen(msg)) < 0) ... SERVER: f = socket(AF_INET, SOCK_STREAM, 0); ... if (bind(f,(struct sockaddr *) &sin, sizeof(sin)) < 0) ... listen(f,5) for (;;) ... len = sizeof(from); g = accept(f,(struct sockaddr *)&from,&len); ... if ((rval = read(g,msg,1024)) < 0) ... The CLIENT succeeds in establishing a connection with the SERVER and sends it a message which the SERVER receives. Now the problem is that the server cannot send a message back to the CLIENT. I tried writing on the socket "g" on the SERVER side but it doesn't send the message. Could somebody tell me what I am doing wrong or what I am not doing. Thank you (you can send me mail if you like). ------------------ Iqbal Mustafa Khan ------------------ khan@iuvax.bacs.indiana.edu Computer Science Department Indiana University Bloomington, Indiana