-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70175cc
commit 8a31bba
Showing
9 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ buffer_delete(buffer); | |
if (argument_count <= 1 || !argument[1]) { | ||
ds_map_destroy(dataMap); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
/// @desc Connects to a server via a socket. | ||
/// @param {String} ServerIP | ||
/// @param {Real} ServerPort | ||
/// @param {String} ServerIP An IP to connect to as a string. e.g. "127.0.0.1" | ||
/// @param {Real} ServerPort A port as a number to connect on. e.g. 3000 | ||
|
||
network_connect_raw(global.patchwire_netSock, argument0, argument1); | ||
var res = network_connect_raw(global.patchwire_netSock, argument0, argument1); | ||
|
||
if (res < 0) { | ||
net_handle_command("connectFailed", ""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ if (ds_map_exists(global.patchwire_netHandlerMap, argument0)) { | |
script_execute(handler, argument1); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
/// @desc Initializes the net system. | ||
/// @param {Real} optionalTimeout a connection timeout in milliseconds. Default: 4000 | ||
/// @param {Boolean} optionalBlocking `true` to pause while connecting, false otherwise. Default: true | ||
|
||
var timeout = 4000; | ||
var blocking = 0; | ||
|
||
if (argument_count > 0) { | ||
timeout = argument[0]; | ||
} | ||
|
||
if (argument_count > 1) { | ||
if (argument[1]) { | ||
blocking = 0; | ||
} else { | ||
blocking = 1; | ||
} | ||
} | ||
|
||
network_set_config(network_config_connect_timeout, timeout); | ||
network_set_config(network_config_use_non_blocking_socket, blocking); | ||
global.patchwire_netSock = network_create_socket(network_socket_tcp); | ||
global.patchwire_netHandlerMap = ds_map_create(); | ||
global.patchwire_netHandlerMap = ds_map_create(); | ||
global.patchwire_connectedStatus = false; | ||
|
||
enum NetEvent { | ||
Command = 0, | ||
Connect = -1, | ||
Disconnect = -2, | ||
ConnectFail = -3, | ||
Unknown = -4 | ||
} |