home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 13,059 of 14,669   
   Barry Margolin to Ramon F Herrera   
   Re: Looking for tutorial code - A TCP sy   
   21 Sep 09 15:22:32   
   
   14a4da62   
   XPost: comp.os.ms-windows.programmer.win32   
   From: barmar@alum.mit.edu   
      
   In article   
   <961dae3c-8bc3-448e-8be3-f4abbe7a46d1@f33g2000vbm.googlegroups.com>,   
    Ramon F Herrera  wrote:   
      
   > On Sep 21, 11:38 am, Barry Margolin  wrote:   
   > > In article   
   > > ,   
   > >  Ramon F Herrera  wrote:   
   > >   
   > > > What I need is to:   
   > >   
   > > >  - client creates a socket (TCP, sync)   
   > > >  - server accepts   
   > > >  - client sends some (say, 4) arguments   
   > > >  - server reads them (I am stuck in this part now)   
   > > >  - server does some processing (I have no problem with this)   
   > > >  - server sends the results back   
   > > >  - client reads them   
   > >   
   > > > A perfect example was the Boost set of daytime (port 13) examples, BUT   
   > > > they do not pass arguments.   
   > >   
   > > I think you need to do some googling on "marshaling" or "serializing".     
   >   
   >  > These are the terms used for representing sequences   
   >  > of values (either structured or individual parameters)   
   >  > in a serial form.   
   >   
   > My problem is much simpler than that. The client is a command line   
   > program which reads a couple of arguments in the classical way (argv   
   > []). All it needs to do is to send them, let's say:   
   >   
   >  - month=october   
   >  - year=2010   
   >   
   > to the server. And then print out the server's results (this part   
   > works fine).   
   >   
   > I figure that the client should write 2 "lines" and the server should   
   > read them. Due to the difficulty in debugging network code (specially   
   > the server) I have made some attempts but I am not sure what is really   
   > going on.   
      
   You have to be careful with such a simple design.  What if you want to   
   allow newline characters in the parameters?  On the Unix CLI you do this   
   with quoting, you need a way to represent it in your protocol.   
      
   >   
   > At this point I am not even sure whether the same socket can be used   
   > for reading and writing.   
      
   There's nothing in TCP/IP or the sockets API that prevents it, and   
   that's the normal way servers are written.   
      
   --   
   Barry Margolin, barmar@alum.mit.edu   
   Arlington, MA   
   *** PLEASE don't copy me on replies, I'll read them in the group ***   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca