[erlang-questions] Newbie: Problem TCP connection erlang-python

Jani Launonen launoja@REDACTED
Thu Jan 31 14:07:45 CET 2008


Should there be socket option {packet, 0} --- i.e. there's no header bytes.

----- Alkuperäinen viesti -----
Lähettäjä: Gerald Kettlgruber <kettlgruber@REDACTED>
Päiväys: torstai, tammikuu 31, 2008 2:58 pm
Aihe: [erlang-questions] Newbie: Problem TCP connection erlang-python
Vastaanottaja: erlang-questions@REDACTED

> 
> Hello, 
> I have a problem concerning a tcp connection between an erlang 
> server and a 
> python client.
> The problem is, that on the server I receive the message, but 
> the format 
> doesn't match. I tried to specify the bits, but this doesn't 
> worked either.
> 
> This is what the server looks like:
> start(Port, Id) ->
>     {ok, Listen} = gen_tcp:listen (Port, [binary, 
> {active,true},{reuseaddr,true}]),
>     accept(Listen, Id).
> accept(Listen, Id)->
>     {ok, Socket} = gen_tcp:accept(Listen),
>     gwe_server:start_agent(tcp_agent, accept, 
> [Listen]),    loop(Socket, Id).
> loop(Socket, Id) ->
>     receive
> 	{tcp, Socket, Bin} ->
>             <<To/integer, X/integer,Y/integer,Z/integer, W/integer>> = Bin,
>             loop(Socket, Id);
> end.
> 
> Python Client looks like this:
> 
> I pack the data with: 
> data = [1,2,3,4,5]
> format= ">iiiii"
> msg = struct.pack(format,*data)
> size = struct.calcsize(format)
> 
> and then send it with 
> sent = self.sock.send(msg[totalsent:]) 
> 
> Would be nice if anyone can help me.
> Thanks,
> Gerald Kettlgruber
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080131/8780cdd0/attachment.htm>


More information about the erlang-questions mailing list