mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Fix for Issue #126 for TCPObject Bad Connect
This commit is contained in:
parent
2291451b8e
commit
e9b1ec5876
1 changed files with 21 additions and 4 deletions
|
|
@ -129,6 +129,7 @@ IMPLEMENT_CALLBACK(TCPObject, onConnectionRequest, void, (const char* address, c
|
||||||
"This callback is used when the TCPObject is listening to a port and a client is attempting to connect.\n"
|
"This callback is used when the TCPObject is listening to a port and a client is attempting to connect.\n"
|
||||||
"@param address Server address connecting from.\n"
|
"@param address Server address connecting from.\n"
|
||||||
"@param ID Connection ID\n"
|
"@param ID Connection ID\n"
|
||||||
|
"@see listen()\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
IMPLEMENT_CALLBACK(TCPObject, onLine, void, (const char* line), (line),
|
IMPLEMENT_CALLBACK(TCPObject, onLine, void, (const char* line), (line),
|
||||||
|
|
@ -424,14 +425,30 @@ DefineEngineMethod(TCPObject, send, void, (const char *data),,
|
||||||
DefineEngineMethod(TCPObject, listen, void, (int port),,
|
DefineEngineMethod(TCPObject, listen, void, (int port),,
|
||||||
"@brief Start listening on the specified port for connections.\n\n"
|
"@brief Start listening on the specified port for connections.\n\n"
|
||||||
|
|
||||||
|
"This method starts a listener which looks for incoming TCP connections to a port. "
|
||||||
|
"You must overload the onConnectionRequest callback to create a new TCPObject to "
|
||||||
|
"read, write, or reject the new connection.\n\n"
|
||||||
|
|
||||||
"@param port Port for this TCPObject to start listening for connections on.\n"
|
"@param port Port for this TCPObject to start listening for connections on.\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Set the port number list\n"
|
|
||||||
"%portNumber = 80;\n\n"
|
|
||||||
|
|
||||||
"// Inform this TCPObject to start listening at the specified port.\n"
|
"// Create a listener on port 8080.\n"
|
||||||
"%thisTCPObj.send(%portNumber);\n"
|
"new TCPObject( TCPListener );\n"
|
||||||
|
"TCPListener.listen( 8080 );\n\n"
|
||||||
|
|
||||||
|
"function TCPListener::onConnectionRequest( %this, %address, %id )\n"
|
||||||
|
"{\n"
|
||||||
|
" // Create a new object to manage the connection.\n"
|
||||||
|
" new TCPObject( TCPClient, %id );\n"
|
||||||
|
"}\n\n"
|
||||||
|
|
||||||
|
"function TCPClient::onLine( %this, %line )\n"
|
||||||
|
"{\n"
|
||||||
|
" // Print the line of text from client.\n"
|
||||||
|
" echo( %line );\n"
|
||||||
|
"}\n"
|
||||||
|
|
||||||
"@endtsexample\n")
|
"@endtsexample\n")
|
||||||
{
|
{
|
||||||
object->listen(U32(port));
|
object->listen(U32(port));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue