Professional Documents
Culture Documents
Script Arguments:
tcp : Set to true to use TCP or false to not use TCP.
udp : Set to true to use UDP or false to not use UDP.
Script Note:
The NetGMS framework will throw errors if you do not call the
Net_Setup script. Calling this script should be done before
attempting to use any other scripts within the framework.
Script Note:
This script uses dynamic memory, make sure to delete the
memory via Net_TcpDestory() when the sockets are no longer
needed.
Script Arguments:
port : Port to create the raw client connection on(server port?).
Stored in the NetTcp_Prt globalvar.
url / ip : The URL or IPv4 address the server is hosted on. Stored
in the NetTcp_Ipa globalvar.
buffer size : Size to use when creating the fixed sized buffer.
Script Notes:
See the Net_TcpServer() script for notes for this script.
Script Arguments:
port : Port to create the client connection on(server port?).
Stored in the NetTcp_Prt globalvar.
url / ip : The URL or IPv4 address the server is hosted on. Stored
in the NetTcp_Ipa globalvar.
buffer size : Size to use when creating the fixed sized buffer.
Script Notes:
See the Net_TcpServer() script for notes for this script.
Script Arguments:
port : Port to host the UDP sever on. Stored in the NetUdp_Prt
globalvar.
maxclients : UDP servers do not support client connections, set
to 0.
url / ip : The URL or IPv4 address to host the server on. Stored
in the NetUdp_Ipa globalvar.
buffer size : Size to use when creating the fixed sized buffer.
Script Notes:
This script uses dynamic memory, make sure to delete the
memory via Net_UdpDestory() when the sockets are no longer
needed.
Net_Handle( script id );
Net_Handle() handles receiving all data from TCP and UDP sockets.
However, the script also handles receiving client connections and removing
clients from the server as they disconnect. When data is received, the data is
passed to a custom user inputted script via "script id". The data passed in
order: buffer ID, buffer size and packet ID.
Script Arguments:
script id : User defined script that will be used to pass to and
process the received data. The user defined script here
should be used to identify packets and process those
packets accordingly.
Script Notes:
When a client connects, the client's socket ID is stored in two
ds_lists, NetTcp_Lst and NetTcp_Que. The ds_List,
NetTcp_Lst, stores the socket ID of each client until each
client disconnects. The ds_list, NetTcp_Que, stores the socket
ID of each client until the client requests it's socket ID via Socket
Requesting.
Script Arguments:
packetid : The ID of the packet being broadcast.
server name : The name(as string) of the UDP server sending
the broadcast.
Net_Bytes( buffer id );
Net_Bytes() returns the total number of bytes written to the buffer from
the current seek position of the buffer. This script is a simple rename and
pass through for GameMaker: Studio's buffer_tell( buffer id ) function.
Net_Analyze( packet id );
Net_Analyze() checks the current connection of a client to a server to
see if the connection is still valid.
Net_Inquire( buffer id );
Net_Inquire() this script is a followup script to Net_UdpCast(). If a
broadcats is received from another UDP server, Net_Inquire() can be used to
process the packet received from the broadcast. Net_Inquire() will read the
server name from the buffer and get the IP address of the server and store it
in the NetUdp_Map ds_map with server name as the key and IP address as
the value.
Socket requesting is a system where the server sends each client a packet,
telling the client to request it's socket ID from the server as a form of
identification.
-------------------------------------
Net_TcpAssets( asset id );
Net_TcpAssets() returns the value of the specified asset via asset id.
Net_UdpAssets( asset id );
Net_UdpAssets() returns the value of the specified asset via asset id.
Extra Constants:
network_error(-1) : used for checking if a socket has an error.
network_noerror(1) : used for checking if a socket has no error.
msg_queue(253) : preset packet id used for socket requesting.
msg_broadcast(254) : preset packet id used for broadcasting.
msg_analyze(255) : preset packet ID for validing the connection to the
server.
triggered_tcp(0) : used for checking if TCP received a packet.
triggered_udp(1) : used for checking if UDP received a packet.