[Python-talk] A few more socket related questions

Larry Keber lakkal at gmail.com
Fri Aug 28 15:26:52 EDT 2009


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).

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

Larry


More information about the Python-talk mailing list