Client/server Bad value on output port 'tcp_inet'
Matthias Lang
matthias@REDACTED
Tue Feb 4 12:23:02 CET 2003
Lars H. Larsen, ICCC writes:
> I'm using OTP R9-0 on a Win32 platform (winsock) W2K and XP
> accsocket:send(#Port<0.119>,{[255,0,0,2]})
> accsock:error Reasson einval
Chandru has already pointed out that you can't pass a tuple as the
second argument to gen_tcp:send/2. You're generating the tuple here:
> {'GETACCTABLE'} ->
> Data= {[255, 0, 0, 2]},
Looking through the module, it looks like it would be a bit clearer if
you used the binary syntax, e.g. instead of writing
> accDecode([255, Length1, Length2, 1 | DataList]) ->
> Length = (Length1 * 256) + Length2,
you could write
accDecode(<<255, Length:16, 1, Data/binary>>)
N.b: the above is _not_ a list. See:
http://www.erlang.org/doc/r9b/doc/extensions/bit_syntax.html
Matthias
More information about the erlang-questions
mailing list