[Python-talk] A few more socket related questions

Larry Keber lakkal at gmail.com
Fri Aug 28 16:44:22 EDT 2009


Lloyd Kvam wrote:
> On Fri, 2009-08-28 at 15:26 -0400, Larry Keber wrote:
>   
>> 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.
>>
>>     
>
> That's very slick.  That was not clear to me from the man page and I've
> always used netcat as a filter.  Thanks for the info.
>
>   

I haven't used it that way yet either, I'm also going by what the wiki 
page says. It may be that you have to use it as a filter, like you 
mention in your other post.  I don't have time right now to test it 
myself. - but from the examples given, it seems like it would.

LArry

>> 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
>> _______________________________________________
>> Python-talk mailing list
>> Python-talk at dlslug.org
>> http://dlslug.org/mailman/listinfo/python-talk
>>     



More information about the Python-talk mailing list