net_connect(addr,port,serve,udp)
Revision as of 10:28, 29 June 2013 by RobertBColton (talk | contribs)
Description
Initializes a socket as either a client or socket as UDP or TCP-IP using the given network address and port. Supports both IPv4 and IPv6, for clients the identifier indicates the server used for receiving messages. Returns an indentifier for the socket or negative on error. Note: Use 127.0.0.1 to connect the server internally as its own client
Parameters
Parameter | Data Type | Description |
---|---|---|
addr | string | network address |
port | string | network port |
server | boolean | whether or not the socket is a server (true) or client (false) |
udp | boolean | whether or not the connection is udp |
Return Values
integer: Returns the id of the socket or negative on error.
Example Call
// demonstrates opening a udp network server socket connection
serversocketid = net_connect("0.0.0.0", "25565", false, true);