TcpServer

SimpleTV ver
SimpleTV v.0.4.8 b9 or above

object = CreateServer(table params)

Description
Create tcp server
Parameters
table of a parameters
Example
local p={}
p.address = '127.0.0.1'
p.service = '1234'
p.eventfunction = "TestTCPServer"
local server = m_simpleTV.TcpServer.CreateServer(p)
if server==nil then ERROR end

function TestTCPServer(Object,Event,Data) --event function
 debug_in_file("event - " .. Event .. '\n')
 debug_in_file("data - " .. Data .. '\n\n')
end 
List of events
'Accept'  -  Client connected to server
'End'     -  Client disconnected  
'Receive' -  On received data (Data parameter is valid)
'Error'   -  On error (Data parameter is error string)

CloseServer(ServerObject)

Description
Close tcp server
Parameters
ServerObject - object, returned by CreateServer

boolean = Send(ServerObject,string data)

Description
Send data to client
Parameters

number = GetWsaError(ServerObject)

Description
return last WSA error
Parameters
Зашли как: Anonymous (Anonymous)
mantis/simpletv/api/tcpserver.txt · Последние изменения: 26/03/2015 20:41 — SergeyVS
 
За исключением случаев, когда указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki