MagicWall
Veteran OT User
- Joined
- Oct 12, 2008
- Messages
- 124
- Solutions
- 6
- Reaction score
- 344
Hi,
I have problem with TCP/IP communication betwen two otclients.
In first OTClient I create server:
otclient/server.cpp at master · edubart/otclient · GitHub
In second OTClient I connect to the server and send something using protocol:
otclient/protocol.cpp at master · edubart/otclient · GitHub
Next I create in first OTClient listener but it doesn't work:
Terminal send (function testConnectListenerOne()) Error: command failed: /modules/terminal_scriptwrite/scripts/target.lua:75: attempt to concatenate a nil value.
Someone have idea how to received messages sended from second to first OTClient?
I check in Process Hacker (network) and I see:
Local Port: 7175 - Listener
Remote Port: 7175 - Established
Remote Port: 7175 - Established
So I think, I connect properly.
I have problem with TCP/IP communication betwen two otclients.
In first OTClient I create server:
otclient/server.cpp at master · edubart/otclient · GitHub
Lua:
local Serv = nil
function testCreateServer()
Serv = Server.create(7175)
end
In second OTClient I connect to the server and send something using protocol:
otclient/protocol.cpp at master · edubart/otclient · GitHub
Lua:
local Send = Protocol.create()
function testConnectSend()
Send:connect("127.0.0.1", 7175)
end
function testConnectSendMes()
msg = OutputMessage.create()
msg:addString('Hello World!')
Send:send(msg)
print('isConnected: '..tostring(Send:isConnected())) --terminal show true
print('isConnecting: '..tostring(Send:isConnecting())) --terminal show false
end
Next I create in first OTClient listener but it doesn't work:
Lua:
local List = Protocol.create()
function testConnectListener()
List:connect("127.0.0.1", 7175)
end
function testConnectListenerOne()
print('Recv: '..List:recv())
end
--Or
testEventServer = {}
function testConnectListener()
testEventServer['myId'] = cycleEvent(function()
local xxx = List:recv()
if xxx then
print(xxx)
end
end, 1)
end
Terminal send (function testConnectListenerOne()) Error: command failed: /modules/terminal_scriptwrite/scripts/target.lua:75: attempt to concatenate a nil value.
Someone have idea how to received messages sended from second to first OTClient?
I check in Process Hacker (network) and I see:
Local Port: 7175 - Listener
Remote Port: 7175 - Established
Remote Port: 7175 - Established
So I think, I connect properly.