From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3190aba277f0ce3e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-05 08:00:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: Thierry Lelegard Newsgroups: comp.lang.ada Subject: Re: Question on Client - Server communication Date: Fri, 05 Jul 2002 16:58:40 +0200 Organization: CANAL+ Technologies Message-ID: <3D25B420.27D9D78B@canal-plus.fr> References: NNTP-Posting-Host: host227.canal-plus.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: s1.read.news.oleane.net 1025881120 3116 194.2.208.227 (5 Jul 2002 14:58:40 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Fri, 5 Jul 2002 14:58:40 +0000 (UTC) X-Mailer: Mozilla 4.78 [fr]C-CCK-MCD C+ (WinNT; U) X-Accept-Language: fr,en,zh-CN,zh-TW Xref: archiver1.google.com comp.lang.ada:26876 Date: 2002-07-05T16:58:40+02:00 List-Id: Preben Randhol wrote : > > I'm doing a small program to learn a bit about socket programming with > clients and servers. Besides I need the program. > > What I want is an application that can talk to the same application > running on a different machine. This is ok and no problem. However I > cannot know the port the application is listening to (there may be > several users runnig the same application on the same machine). > Therefore in order to contact the other application I need a server > running on each machine with a known port number. Then I can do this (_A > = on machine A, _B on machine B): App_A contacts Server_B which tells > App_B to contact App_A on port XXXX. So Server_B will only deliver this > message to App_B and not the whole stream between the two. Does this > seem like a OK way to do this? Or is there a better way using socket > programming (not GLADE). What you describe already exists, this is the portmapper server (port 111). We have the same problem as you and we use the portmapper for all our applications. A portmapper exist on all UNIXen and VMS. For Windows (a so-called OS which does nothing like the others), we are written a simple portmapper daemon. Writing a portmapper daemon is trivial. The only tricky part (on both client and server side) is the underlying protocol based on Sun RPC and XDR. See the following references: RFC 1057 : RPC, Remote Procedure Call Protocol Specification, Version 2 (Appendix A describes the Portmapper interface). RFC 1014 : XDR, External Data Representation Standard. -Thierry