[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket question
- From: Ulrich Schmidt <u.sch.zw@...>
- Date: Sat, 12 Apr 2014 11:27:57 +0200
I am using lua5.2 on windows7. (shortend code below.)
using taskmanger i see my prog listening on tcpv6 but tcp.
probably my quick fix is the easiest way to force listening on tcp
insted tcpv6. the old game client i want to comunicate with seems unable
to use tcpv6.
--8<---------------------------------------------------
socket = require("socket");
host = host or "localhost";
port = port or "10300";
--socket.tcp6 = socket.tcp -- quick hack
server = assert(socket.bind(host, port));
ack = "\n";
while 1 do
print("server: waiting for client connection...");
control = assert(server:accept());
print("server: incoming connection...");
while 1 do
command, emsg = control:receive();
if emsg == "closed" then
control:close()
break
end
assert(command, emsg)
assert(control:send(ack));
--print(dumpHex(command));
--print(dumpDec(command));
end
end
--8<---------------------------------------------------
greetings.
Ulrich.
Am 11.04.2014 15:34, schrieb Justin Cormack:
On Apr 10, 2014 12:10 PM, "Ulrich Schmidt" <u.sch.zw@gmx.de
<mailto:u.sch.zw@gmx.de>> wrote:
>
> Hi.
> i downloaded and installed luasocket from luadist. all test run fine.
>
> i tried a tcp server but he listen on a TVPV6 port instead TCPV4.
>
> Any suggestions how to listen on TCPV4?
>
It is probably an ipv4 mapped ipv6 socket so you can still connect to it
over ipv4.
Otherwise it would help to know your OS and a short example program.
Justin