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

Gerald Kettlgruber kettlgruber@REDACTED
Thu Jan 31 19:10:09 CET 2008


Thx, 
I found out, that the problem is on the python side, where packaging is done.

Regards 
Gerald Kettlgruber
Am Donnerstag, 31. Januar 2008 17:35:59 schrieb Andreas Hillqvist:
> Just a small note:
> Both raw and 0 stand for that no packaging is done.
> So there should be no difference between:
> {packet, 0} or {packet, raw}
>
>
> Regards
> Andreas Hillqvist
>
> 2008/1/31, Jani Launonen <launoja@REDACTED>:
> > 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
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions





More information about the erlang-questions mailing list