[Python-talk] A few more socket related questions

bruce.labitt at autoliv.com bruce.labitt at autoliv.com
Fri Aug 28 15:47:26 EDT 2009


Larry Keber <lakkal at gmail.com> wrote on 08/28/2009 03:26:52 PM:

> bruce.labitt at autoliv.com wrote:
> >> You could also consider using Larry's netcat (nc) suggestion.
> >>
> >> 
> >
> > I looked at netcat after Larry mentioned it.  If I understand 
correctly, 
> > netcat will do a file transfer, but not a RAM machine 1 to RAM machine 
2 
> > transfer.  Or, I don't understand the tool, nor how to use it yet.
> >
> > 
> 
> Basically, netcat acts as the server.  When your client establishes the 
> socket connection, netcat runs your C FFT program, and all input from 
> the socket gets sent to C program's stdin, and output from stdout gets 
> sent back out the socket to your client.
> 
> So, in this situation, the client would open a socket to the server, and 

> send a command (as you've designed in other posts - including the data 
> size and the data itself). 
> 
> On the server side, upon a connection being established, netcat would 
> invoke your C FFT program and send that command+size+data to the C 
> program's stdin, so it could read it without you having to write C 
> socket code.  Then the C program simply writes the results (maybe using 
> the same kind of protocol: a command like 'result' followed by the 
> result data size followed by 'data' followed by the result data) out to 
> stdout, which netcat magically sends back over the socket to the python 
> client program (which has to call recv() on the socket to pick up the 
> response).
> 

Next week I will have to read this email again 5 to 6 times.  Then I will 
try to do it.  Be prepared for more questions though - Mr. Expert :)

So let us assume I have been successful in rewriting my C code to accept 
commands and data from stdin, and to output data on stdout.  How would one 
invoke netcat?

$ socket | netcat (various options) | socket    ?

Hey, I'm out of my league here...

> This is all much more interesting than my actual work :-).
> 

Funny how that is.  It really isn't interesting while you are flailing 
around, but describe any of it to someone else and they get all goo-goo 
over it.  It is very satisfying when you finally get it to work though.

Oh, yeah, and I have to get work done too.  Wait, this is the stuff I have 
to do, so I can get my work done...

> Larry

Interesting thread, glad I bought it up :P
-Bruce


******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail.  Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************


More information about the Python-talk mailing list