Forums » Bugs
Send on TCPSocket can crash game
local sock = TCPSocket()
local function ch()
-- sock:GetSocketError()
-- sock:Recv()
console_print("CONNECT "..tostring(sock:Send("bla")))
sock:Disconnect()
end
sock:SetWriteHandler(ch)
sock:Connect("localhost", 1234)
Assuming nothing is running on 1234. If any of the commented out lines are uncommented the game crashes if I run this script under 32bit linux. It's normally easy to avoid but it's kind of strange that it crashes the game..
EDIT:
doh ..here's an even simpler case. This one pops up the bug reporter.. above doesn't:
local sock = TCPSocket()
sock:Send("bla")
local function ch()
-- sock:GetSocketError()
-- sock:Recv()
console_print("CONNECT "..tostring(sock:Send("bla")))
sock:Disconnect()
end
sock:SetWriteHandler(ch)
sock:Connect("localhost", 1234)
Assuming nothing is running on 1234. If any of the commented out lines are uncommented the game crashes if I run this script under 32bit linux. It's normally easy to avoid but it's kind of strange that it crashes the game..
EDIT:
doh ..here's an even simpler case. This one pops up the bug reporter.. above doesn't:
local sock = TCPSocket()
sock:Send("bla")
looks like :Send is undeclared at that point, so an non-handled condition.
No.. Send is declared in both cases. Otherwise the interpreter would complain. Inserting a print(sock.Send) shows that too.