Return to BSD News archive
Xref: sserve comp.client-server:426 comp.unix.wizards:28981 comp.unix.questions:32552 comp.unix.bsd:11723 Newsgroups: comp.client-server,comp.unix.wizards,fr.network.divers,comp.unix.questions,comp.unix.bsd Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!univ-lyon1.fr!zaphod.crihan.fr!pipex!marble.uknet.ac.uk!mcsun!julienas!jussieu!amertume.ufr-info-p7.ibp.fr!truongta From: truongta@amertume.ufr-info-p7.ibp.fr (Vincent) Subject: Point-to-Point Sockets communication Message-ID: <1993Mar26.193559.13662@jussieu.fr> Sender: news@jussieu.fr (Le Facteur) Nntp-Posting-Host: amertume.ufr-info-p7.ibp.fr Organization: Universite PARIS 7 - UFR d'Informatique Date: Fri, 26 Mar 1993 19:35:59 GMT Lines: 55 Hi, My problem is that i'm trying to connect 2 processes without obliging one of them to be server or client. Just a point-to-point connection and then after exchanging data, even if I have to know their address and port numbers before hand. But, to me, sockets are only good for c/s connection. So what I *try* to do is, for the same socket, to run a server and a client process, so that the processes connect themselves (no matter who's the c or s) and that i can finally exchange data. Here what i thought of: main() { socket=.... bind(..) fork() { /* parent */ listen(..) accept(..) /* I'm now connected with the other process let's quit from here and start exchanging data */ } {/* child */ connect(..) /* I'm now connected with the other process let's quit from here and start exchanging data */ ... } /* then follows the same code for the parent or the child * to exchange data */ .... .... } I think this is possible as the first (parent or child) who'll be connected will disable the socket to use for another connection. Another problem will be: where should I put the code that I want the parent or child to execute? Anyway if anybody can help me (advice...codes...) Thanx, -- Vincent --------------------------------------------------------- UFR d'Informatique | Paris: "Fluctuat Nec Mergitur" Universite Paris 7 | Truongta@amertume.ufr-info-p7.ibp.fr ---------------------------------------------------------