Networking Guides
How to make a RESTful API call using Splashkit Routing With Servers Getting Started With ServersFunctions
Download Bitmap
Download an image from a web server and load it into SplashKit so that you can use it.
- Return Type
-
The bitmap that was loaded
- Parameters
-
Name Type Description Name String
The name of the bitmap resource when it is loaded
URL String
The URL path to the image resoure
Port Unsigned Short
The port to connect to on the server
- Signatures
-
bitmap download_bitmap(const string &name, const string &url, unsigned short port)
public static Bitmap SplashKit.DownloadBitmap(string name, string url, ushort port);
function DownloadBitmap(const name: String; const url: String; port: Word): Bitmap
def download_bitmap(name, url, port):
Download Font
Download a font from a web server and load it into SplashKit so that you can use it.
- Return Type
-
The font that was loaded
- Parameters
-
Name Type Description Name String
The name of the font resource when it is loaded
URL String
The URL path to the font resoure
Port Unsigned Short
The port to connect to on the server
- Signatures
-
font download_font(const string &name, const string &url, unsigned short port)
public static Font SplashKit.DownloadFont(string name, string url, ushort port);
function DownloadFont(const name: String; const url: String; port: Word): Font
def download_font(name, url, port):
Download Music
Download a music file from a web server and load it into SplashKit so that you can use it.
- Return Type
-
The music that was loaded
- Parameters
-
Name Type Description Name String
The name of the music resource when it is loaded
URL String
The URL path to the music resoure
Port Unsigned Short
The port to connect to on the server
- Signatures
-
music download_music(const string &name, const string &url, unsigned short port)
public static Music SplashKit.DownloadMusic(string name, string url, ushort port);
function DownloadMusic(const name: String; const url: String; port: Word): Music
def download_music(name, url, port):
Download Sound Effect
Download a sound effect from a web server and load it into SplashKit so that you can use it.
- Return Type
-
The sound effect that was loaded
- Parameters
-
Name Type Description Name String
The name of the sound effect resource when it is loaded
URL String
The URL path to the sound effect resoure
Port Unsigned Short
The port to connect to on the server
- Signatures
-
sound_effect download_sound_effect(const string &name, const string &url, unsigned short port)
public static SoundEffect SplashKit.DownloadSoundEffect(string name, string url, ushort port);
function DownloadSoundEffect(const name: String; const url: String; port: Word): SoundEffect
def download_sound_effect(name, url, port):
Free Response
Free the response resource.
- Parameters
-
Name Type Description Response The response to free
- Signatures
-
void free_response(http_response response)
public void HttpResponse.FreeResponse(); public static void SplashKit.FreeResponse(HttpResponse response);
procedure FreeResponse(response: HttpResponse)
def free_response(response):
- Guides
- How to make a RESTful API call using Splashkit
HTTP GET
Make a get request to access a resource on the internet.
- Return Type
-
The response with all of the data received
- Parameters
-
Name Type Description URL String
The path to the resource, for example http://splashkit.io
Port Unsigned Short
The port on the server (80 for http, 443 for https)
- Signatures
-
http_response http_get(const string &url, unsigned short port)
public static HttpResponse SplashKit.HttpGet(string url, ushort port);
function HttpGet(const url: String; port: Word): HttpResponse
def http_get(url, port):
- Guides
- How to make a RESTful API call using Splashkit
HTTP POST
HTTP POST
Post the supplied information to the indicated url with the given headers.
- Return Type
-
The response from the server
- Parameters
-
Name Type Description URL String
The url of the server to post the data to
Port Unsigned Short
The port to connect to on the server
Body String
The body of the message to post
Headers Dynamic Array
The headers of the request
- Signatures
-
http_response http_post(const string &url, unsigned short port, const string &body, const vector<string> &headers)
public static HttpResponse SplashKit.HttpPost(string url, ushort port, string body, List<string> headers);
function HttpPost(const url: String; port: Word; const body: String; const headers: ArrayOfString): HttpResponse
def http_post_with_headers(url, port, body, headers):
- Guides
- How to make a RESTful API call using Splashkit
HTTP POST
Post the supplied information to the indicated url.
- Return Type
-
The response from the server
- Parameters
-
Name Type Description URL String
The url of the server to post the data to
Port Unsigned Short
The port to connect to on the server
Body String
The body of the message to post
- Signatures
-
http_response http_post(const string &url, unsigned short port, string body)
public static HttpResponse SplashKit.HttpPost(string url, ushort port, string body);
function HttpPost(const url: String; port: Word; body: String): HttpResponse
def http_post(url, port, body):
- Guides
- How to make a RESTful API call using Splashkit
HTTP Response To String
Read the HTTP response and convert it to text
- Return Type
-
String
The data from the response as text
- Parameters
-
Name Type Description Response The response from the server
- Signatures
-
string http_response_to_string(http_response response)
public static string SplashKit.HttpResponseToString(HttpResponse response);
function HttpResponseToString(response: HttpResponse): String
def http_response_to_string(response):
- Guides
- How to make a RESTful API call using Splashkit
Save Response To File
Save the HTTP response downloaded into a file.
- Parameters
-
Name Type Description Response The response from the server
Path String
The path to the file where the response should be saved
- Signatures
-
void save_response_to_file(http_response response, string path)
public static void SplashKit.SaveResponseToFile(HttpResponse response, string path);
procedure SaveResponseToFile(response: HttpResponse; path: String)
def save_response_to_file(response, path):
Has Incoming Requests
Returns true if the given Web Sever
has pending requests.
- Return Type
-
Boolean
Returns a
Boolean
denoting whether theWeb Server
has pending requests. - Parameters
-
Name Type Description Server The
Web Server
to check for waiting requests. - Signatures
-
bool has_incoming_requests(web_server server)
public bool WebServer.HasIncomingRequests { get } public static bool SplashKit.HasIncomingRequests(WebServer server);
function HasIncomingRequests(server: WebServer): Boolean
def has_incoming_requests(server):
Is DELETE Request For
Checks if a request wants to delete a given resource.
- Return Type
-
Boolean
True if the request is a HTTP DELETE request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_delete_request_for(http_request request, const string &path)
public bool HttpRequest.IsDeleteRequestFor(string path); public static bool SplashKit.IsDeleteRequestFor(HttpRequest request, string path);
function IsDeleteRequestFor(request: HttpRequest; const path: String): Boolean
def is_delete_request_for(request, path):
Is GET Request For
Checks if a request wants to get a given resource.
- Return Type
-
Boolean
True if the request is a HTTP GET request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_get_request_for(http_request request, const string &path)
public bool HttpRequest.IsGetRequestFor(string path); public static bool SplashKit.IsGetRequestFor(HttpRequest request, string path);
function IsGetRequestFor(request: HttpRequest; const path: String): Boolean
def is_get_request_for(request, path):
- Guides
- Routing With Servers
Is Options Request For
Checks if a request wants to check options for given resource.
- Return Type
-
Boolean
True if the request is a HTTP OPTIONS request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_options_request_for(http_request request, const string &path)
public bool HttpRequest.IsOptionsRequestFor(string path); public static bool SplashKit.IsOptionsRequestFor(HttpRequest request, string path);
function IsOptionsRequestFor(request: HttpRequest; const path: String): Boolean
def is_options_request_for(request, path):
Is POST Request For
Checks if a request wants to create (post) a given resource.
- Return Type
-
Boolean
True if the request is a HTTP POST request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_post_request_for(http_request request, const string &path)
public bool HttpRequest.IsPostRequestFor(string path); public static bool SplashKit.IsPostRequestFor(HttpRequest request, string path);
function IsPostRequestFor(request: HttpRequest; const path: String): Boolean
def is_post_request_for(request, path):
Is PUT Request For
Checks if a request wants to update (put) a given resource.
- Return Type
-
Boolean
True if the request is a HTTP PUT request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_put_request_for(http_request request, const string &path)
public bool HttpRequest.IsPutRequestFor(string path); public static bool SplashKit.IsPutRequestFor(HttpRequest request, string path);
function IsPutRequestFor(request: HttpRequest; const path: String): Boolean
def is_put_request_for(request, path):
Is Request For
Checks if a request is after a given resource.
- Return Type
-
Boolean
True if the request is for the indicated method and path
- Parameters
-
Name Type Description Request The request to check
Method The kind of request
Path String
The resource/route path
- Signatures
-
bool is_request_for(http_request request, http_method method, const string &path)
public bool HttpRequest.IsRequestFor(HttpMethod method, string path); public static bool SplashKit.IsRequestFor(HttpRequest request, HttpMethod method, string path);
function IsRequestFor(request: HttpRequest; method: HttpMethod; const path: String): Boolean
def is_request_for(request, method, path):
Is Trace Request For
Checks if a request wants to trace a given resource.
- Return Type
-
Boolean
True if the request is a HTTP TRACE request for
Path
- Parameters
-
Name Type Description Request The request to check
Path String
The resource/route path
- Signatures
-
bool is_trace_request_for(http_request request, const string &path)
public bool HttpRequest.IsTraceRequestFor(string path); public static bool SplashKit.IsTraceRequestFor(HttpRequest request, string path);
function IsTraceRequestFor(request: HttpRequest; const path: String): Boolean
def is_trace_request_for(request, path):
Next Web Request
Returns the next request on a given Web Server
instance
- Return Type
-
Returns the next request on the given
Web Server
instance. - Parameters
-
Name Type Description Server The
Web Server
to get theHTTP Request
from. - Signatures
-
http_request next_web_request(web_server server)
public HttpRequest WebServer.NextWebRequest { get } public static HttpRequest SplashKit.NextWebRequest(WebServer server);
function NextWebRequest(server: WebServer): HttpRequest
def next_web_request(server):
- Guides
- Routing With Servers Getting Started With Servers
Request Body
Returns the body of the request.
- Return Type
-
String
The body of the request.
- Parameters
-
Name Type Description R A request object.
- Signatures
-
string request_body(http_request r)
public string HttpRequest.Body { get } public static string SplashKit.RequestBody(HttpRequest r);
function RequestBody(r: HttpRequest): String
def request_body(r):
Request Has Query Parameter
Returns true if the parameter exists in the query string.
- Return Type
-
Boolean
True if the parameter exists in the user's request.
- Parameters
-
Name Type Description R A request object.
Name String
The name of the parameter to check
- Signatures
-
bool request_has_query_parameter(http_request r, const string &name)
public bool HttpRequest.RequestHasQueryParameter(string name); public static bool SplashKit.RequestHasQueryParameter(HttpRequest r, string name);
function RequestHasQueryParameter(r: HttpRequest; const name: String): Boolean
def request_has_query_parameter(r, name):
Request Method
Returns the HTTP method of the client request.
- Return Type
-
Returns the request method.
- Parameters
-
Name Type Description R A request object.
- Signatures
-
http_method request_method(http_request r)
public HttpMethod HttpRequest.Method { get } public static HttpMethod SplashKit.RequestMethod(HttpRequest r);
function RequestMethod(r: HttpRequest): HttpMethod
def request_method(r):
Request Query Parameter
Returns the value of a parameter from within the query string, or the supplied default if no matching parameter is found.
- Return Type
-
String
Returns value of the parameter from the query string, or the default value if the parameter is not found.
- Parameters
-
Name Type Description R A request object.
Name String
The name of the parameter to fetch
Default Value String
The value to return if the named parameter is not in the query string.
- Signatures
-
string request_query_parameter(http_request r, const string &name, const string &default_value)
public string HttpRequest.RequestQueryParameter(string name, string defaultValue); public static string SplashKit.RequestQueryParameter(HttpRequest r, string name, string defaultValue);
function RequestQueryParameter(r: HttpRequest; const name: String; const defaultValue: String): String
def request_query_parameter(r, name, default_value):
Request Query String
Returns the URI query string of the client request.
- Return Type
-
String
Returns the requested URI queries in the form of a string.
- Parameters
-
Name Type Description R A request object.
- Signatures
-
string request_query_string(http_request r)
public string HttpRequest.QueryString { get } public static string SplashKit.RequestQueryString(HttpRequest r);
function RequestQueryString(r: HttpRequest): String
def request_query_string(r):
Request URI
Returns the server URI of the client request.
- Return Type
-
String
Returns the requested URI in the form of a string.
- Parameters
-
Name Type Description R A request object.
- Signatures
-
string request_uri(http_request r)
public string HttpRequest.URI { get } public static string SplashKit.RequestURI(HttpRequest r);
function RequestURI(r: HttpRequest): String
def request_uri(r):
- Guides
- Routing With Servers
Request URI Stubs
Returns an array of strings representing each stub of the URI.
For example a request sent to http://localhost:8080/names/0 returns...
["names", "0"]
- Return Type
-
Dynamic Array
The array of stubs as strings.
- Parameters
-
Name Type Description R The request for retrieving URI to split into stubs.
- Signatures
-
vector<string> request_uri_stubs(http_request r)
public List<string> HttpRequest.URIStubs { get } public static List<string> SplashKit.RequestURIStubs(HttpRequest r);
function RequestURIStubs(r: HttpRequest): ArrayOfString
def request_uri_stubs(r):
- Guides
- Routing With Servers
Send Css File Response
Serves a css file to the given HTTP Request
.
- Parameters
-
Name Type Description R The request which is asking for the resource.
Filename String
The name of the file in Resources/server
- Signatures
-
void send_css_file_response(http_request r, const string &filename)
public void HttpRequest.SendCSSFileResponse(string filename); public static void SplashKit.SendCSSFileResponse(HttpRequest r, string filename);
procedure SendCSSFileResponse(r: HttpRequest; const filename: String)
def send_css_file_response(r, filename):
- Guides
- Getting Started With Servers
Send File Response
Serves a file to the given HTTP Request
.
- Parameters
-
Name Type Description R The request which is asking for the resource.
Filename String
The name of the file in Resources/server
Content Type String
The type of content being send:
- Signatures
-
void send_file_response(http_request r, const string &filename, const string &content_type)
public void HttpRequest.SendFileResponse(string filename, string contentType); public static void SplashKit.SendFileResponse(HttpRequest r, string filename, string contentType);
procedure SendFileResponse(r: HttpRequest; const filename: String; const contentType: String)
def send_file_response(r, filename, content_type):
- Guides
- Routing With Servers Getting Started With Servers
Send HTML File Response
Serves a HTML file to the given HTTP Request
.
- Parameters
-
Name Type Description R The request which is asking for the resource.
Filename String
The name of the file in Resources/server
- Signatures
-
void send_html_file_response(http_request r, const string &filename)
public void HttpRequest.SendHtmlFileResponse(string filename); public static void SplashKit.SendHtmlFileResponse(HttpRequest r, string filename);
procedure SendHtmlFileResponse(r: HttpRequest; const filename: String)
def send_html_file_response(r, filename):
- Guides
- Getting Started With Servers
Send Javascript File Response
Serves a javascript file to the given HTTP Request
.
- Parameters
-
Name Type Description R The request which is asking for the resource.
Filename String
The name of the file in Resources/server
- Signatures
-
void send_javascript_file_response(http_request r, const string &filename)
public void HttpRequest.SendJavascriptFileResponse(string filename); public static void SplashKit.SendJavascriptFileResponse(HttpRequest r, string filename);
procedure SendJavascriptFileResponse(r: HttpRequest; const filename: String)
def send_javascript_file_response(r, filename):
- Guides
- Getting Started With Servers
Send Response
-
Send Response
(
r
:
HTTP Request
) -
Send Response
(
r
:
HTTP Request
message :String
) -
Send Response
(
r
:
HTTP Request
code :HTTP Status Code
) -
Send Response
(
r
:
HTTP Request
code :HTTP Status Code
message :String
) -
Send Response
(
r
:
HTTP Request
code :HTTP Status Code
message :String
content_type :String
) -
Send Response
(
r
:
HTTP Request
j :JSON
)
Send Response
Sends a response with no content to a HTTP Request
.
- Parameters
-
Name Type Description R The
HTTP Request
to send the response to - Signatures
-
void send_response(http_request r)
public void HttpRequest.SendResponse(); public static void SplashKit.SendResponse(HttpRequest r);
procedure SendResponse(r: HttpRequest)
def send_response_empty(r):
- Guides
- Routing With Servers
Send Response
Sends a message to a given HTTP Request
.
- Parameters
-
Name Type Description R The request to be sent.
Message String
The message to be sent
- Signatures
-
void send_response(http_request r, const string &message)
public void HttpRequest.SendResponse(string message); public static void SplashKit.SendResponse(HttpRequest r, string message);
procedure SendResponse(r: HttpRequest; const message: String)
def send_response(r, message):
- Guides
- Routing With Servers
Send Response
Sends a response code to a given HTTP Request
.
- Parameters
-
Name Type Description R The
HTTP Request
to send the response toCode The HTTP status code to be sent.
- Signatures
-
void send_response(http_request r, http_status_code code)
public void HttpRequest.SendResponse(HttpStatusCode code); public static void SplashKit.SendResponse(HttpRequest r, HttpStatusCode code);
procedure SendResponse(r: HttpRequest; code: HttpStatusCode)
def send_response_json_with_status(r, code):
- Guides
- Routing With Servers
Send Response
Sends a message to a given HTTP Request
with the specified content type.
- Parameters
-
Name Type Description R The
HTTP Request
to send the response toCode The HTTP status code to be sent.
Message String
The messsage, in the form of a
HTTP Response
, to be sent. - Signatures
-
void send_response(http_request r, http_status_code code, const string &message)
public void HttpRequest.SendResponse(HttpStatusCode code, string message); public static void SplashKit.SendResponse(HttpRequest r, HttpStatusCode code, string message);
procedure SendResponse(r: HttpRequest; code: HttpStatusCode; const message: String)
def send_response_with_status(r, code, message):
- Guides
- Routing With Servers
Send Response
Sends a message to a given HTTP Request
with the specified content type.
- Parameters
-
Name Type Description R The
HTTP Request
to send the response toCode The HTTP status code to be sent.
Message String
The messsage, in the form of a
HTTP Response
, to be sent.Content Type String
The content type of the response.
- Signatures
-
void send_response(http_request r, http_status_code code, const string &message, const string &content_type)
public void HttpRequest.SendResponse(HttpStatusCode code, string message, string contentType); public static void SplashKit.SendResponse(HttpRequest r, HttpStatusCode code, string message, string contentType);
procedure SendResponse(r: HttpRequest; code: HttpStatusCode; const message: String; const contentType: String)
def send_response_with_status_and_content_type(r, code, message, content_type):
- Guides
- Routing With Servers
Send Response
Send a JSON response to a given HTTP Request
- Parameters
-
Name Type Description R The request the response belongs to.
J The json to be sent.
- Signatures
-
void send_response(http_request r, json j)
public void HttpRequest.SendResponse(Json j); public static void SplashKit.SendResponse(HttpRequest r, Json j);
procedure SendResponse(r: HttpRequest; j: Json)
def send_response_json(r, j):
- Guides
- Routing With Servers
Split URI Stubs
Returns an array of strings representing each stub of the URI.
For example a request sent to http://localhost:8080/names/0 returns...
["names", "0"]
- Return Type
-
Dynamic Array
The array of stubs as strings.
- Parameters
-
Name Type Description URI String
The URI to split into stubs.
- Signatures
-
vector<string> split_uri_stubs(const string &uri)
public static List<string> WebServer.SplitURIStubs(string uri); public static List<string> SplashKit.SplitURIStubs(string uri);
function SplitURIStubs(const uri: String): ArrayOfString
def split_uri_stubs(uri):
Start Web Server
Start Web Server
Creates a new web server instance and starts it.
- Return Type
-
Returns a new
Web Sever
instance. - Signatures
-
web_server start_web_server()
public static WebServer SplashKit.StartWebServer(); public WebServer();
function StartWebServer(): WebServer
def start_web_server_with_default_port():
- Guides
- Routing With Servers Getting Started With Servers
Start Web Server
Starts the web server on a given port number.
- Return Type
-
Returns a new
Web Server
instance. - Parameters
-
Name Type Description Port Unsigned Short
The port number to connect through.
- Signatures
-
web_server start_web_server(unsigned short port)
public static WebServer SplashKit.StartWebServer(ushort port); public WebServer(ushort port);
function StartWebServer(port: Word): WebServer
def start_web_server(port):
- Guides
- Routing With Servers Getting Started With Servers
Stop Web Server
Stops a given Web Server
instance.
- Parameters
-
Name Type Description Server The server instance to stop.
- Signatures
-
void stop_web_server(web_server server)
public void WebServer.StopWebServer(); public static void SplashKit.StopWebServer(WebServer server);
procedure StopWebServer(server: WebServer)
def stop_web_server(server):
- Guides
- Routing With Servers
Accept All New Connections
Accept new connections for all servers.
- Return Type
-
Boolean
True if there were accepted connections
- Signatures
-
bool accept_all_new_connections()
public static bool Networking.AcceptAllNewConnections(); public static bool SplashKit.AcceptAllNewConnections();
function AcceptAllNewConnections(): Boolean
def accept_all_new_connections():
Accept New Connection
Accept new connections for a server
- Return Type
-
Boolean
True if a connection was accepted
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
bool accept_new_connection(server_socket server)
public bool ServerSocket.AcceptNewConnection(); public static bool SplashKit.AcceptNewConnection(ServerSocket server);
function AcceptNewConnection(server: ServerSocket): Boolean
def accept_new_connection(server):
Broadcast Message
Broadcast Message
Broadcast a message to all connections of a server.
- Parameters
-
Name Type Description A Msg String
The message to send
Svr The server to send the message to.
- Signatures
-
void broadcast_message(const string &a_msg, server_socket svr)
public void ServerSocket.BroadcastMessage(string aMsg); public static void SplashKit.BroadcastMessage(string aMsg, ServerSocket svr);
procedure BroadcastMessage(const aMsg: String; svr: ServerSocket)
def broadcast_message(a_msg, svr):
Broadcast Message
Broadcase a message to all of the connections.
- Parameters
-
Name Type Description A Msg String
The message to send
- Signatures
-
void broadcast_message(const string &a_msg)
public static void Networking.BroadcastMessage(string aMsg); public static void SplashKit.BroadcastMessage(string aMsg);
procedure BroadcastMessage(const aMsg: String)
def broadcast_message_to_all(a_msg):
Broadcast Message
Broadcast a message to all connections of a server.
- Parameters
-
Name Type Description A Msg String
The message to send
Name String
The name of the server to send the message to.
- Signatures
-
void broadcast_message(const string &a_msg, const string &name)
public static void Networking.BroadcastMessage(string aMsg, string name); public static void SplashKit.BroadcastMessage(string aMsg, string name);
procedure BroadcastMessage(const aMsg: String; const name: String)
def broadcast_message_to_server_named(a_msg, name):
Check Network Activity
Check network activity, looking for new connections and messages.
- Signatures
-
void check_network_activity()
public static void Networking.CheckNetworkActivity(); public static void SplashKit.CheckNetworkActivity();
procedure CheckNetworkActivity()
def check_network_activity():
Clear Messages
Clear Messages
Clear all of the messages from a server or connection with the supplied name.
- Parameters
-
Name Type Description Name String
The name of the connection or the server to clear.
- Signatures
-
void clear_messages(const string &name)
public static void Networking.ClearMessages(string name); public static void SplashKit.ClearMessages(string name);
procedure ClearMessages(const name: String)
def clear_messages_from_name(name):
Clear Messages
Clear all of the messages from a connection.
- Parameters
-
Name Type Description A Connection The connection
- Signatures
-
void clear_messages(connection a_connection)
public void Connection.ClearMessages(); public static void SplashKit.ClearMessages(Connection aConnection);
procedure ClearMessages(aConnection: Connection)
def clear_messages_from_connection(a_connection):
Clear Messages
Clear all of the messages from a server.
- Parameters
-
Name Type Description Svr The server to clear the messages from
- Signatures
-
void clear_messages(server_socket svr)
public void ServerSocket.ClearMessages(); public static void SplashKit.ClearMessages(ServerSocket svr);
procedure ClearMessages(svr: ServerSocket)
def clear_messages_from_server(svr):
Close All Connections
Close all of the connections you have opened. This does not close connections to servers.
- Signatures
-
void close_all_connections()
public static void Networking.CloseAllConnections(); public static void SplashKit.CloseAllConnections();
procedure CloseAllConnections()
def close_all_connections():
Close All Servers
Close all of the servers that are currently open.
- Signatures
-
void close_all_servers()
public static void Networking.CloseAllServers(); public static void SplashKit.CloseAllServers();
procedure CloseAllServers()
def close_all_servers():
Close Connection
Close Connection
Close the connection
- Return Type
-
Boolean
True if this succeeds.
- Parameters
-
Name Type Description A Connection The connection to close
- Signatures
-
bool close_connection(connection a_connection)
public bool Connection.CloseConnection(); public static bool SplashKit.CloseConnection(Connection aConnection);
function CloseConnection(aConnection: Connection): Boolean
def close_connection(a_connection):
Close Connection
Close the connection
- Return Type
-
Boolean
True if this succeeds.
- Parameters
-
Name Type Description Name String
The name of the connection to close
- Signatures
-
bool close_connection(const string &name)
public static bool Networking.CloseConnection(string name); public static bool SplashKit.CloseConnection(string name);
function CloseConnection(const name: String): Boolean
def close_connection_named(name):
Close Message
Closes the message.
- Parameters
-
Name Type Description Msg The message to close
- Signatures
-
void close_message(message msg)
public void Message.CloseMessage(); public static void SplashKit.CloseMessage(Message msg);
procedure CloseMessage(msg: Message)
def close_message(msg):
Close Server
Close Server
Closes the server with the indicated name.
- Return Type
-
Boolean
True if the server was closed successfully
- Parameters
-
Name Type Description Name String
The name of the server to close
- Signatures
-
bool close_server(const string &name)
public static bool Networking.CloseServer(string name); public static bool SplashKit.CloseServer(string name);
function CloseServer(const name: String): Boolean
def close_server_named(name):
Close Server
Closes the server, all connections with clients will be shut and the port will be closed.
- Return Type
-
Boolean
True if the close was successful
- Parameters
-
Name Type Description Svr The server to close
- Signatures
-
bool close_server(server_socket svr)
public bool ServerSocket.CloseServer(); public static bool SplashKit.CloseServer(ServerSocket svr);
function CloseServer(svr: ServerSocket): Boolean
def close_server(svr):
Connection Count
Connection Count
Returns the number of clients connected to a server.
- Return Type
-
Unsigned Integer
The number of connected clients
- Parameters
-
Name Type Description Name String
The name of the server to check
- Signatures
-
unsigned int connection_count(const string &name)
public static uint Networking.ConnectionCount(string name); public static uint SplashKit.ConnectionCount(string name);
function ConnectionCount(const name: String): Cardinal
def connection_count_named(name):
Connection Count
Returns the number of clients connected to a server.
- Return Type
-
Unsigned Integer
The number of connected clients
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
unsigned int connection_count(server_socket server)
public uint ServerSocket.ConnectionCount { get } public static uint SplashKit.ConnectionCount(ServerSocket server);
function ConnectionCount(server: ServerSocket): Cardinal
def connection_count(server):
Connection IP
Connection IP
Gets the ip address of the passed in connection.
- Return Type
-
Unsigned Integer
The ip addres of the connection
- Parameters
-
Name Type Description A Connection The connection
- Signatures
-
unsigned int connection_ip(connection a_connection)
public uint Connection.IP { get } public static uint SplashKit.ConnectionIP(Connection aConnection);
function ConnectionIP(aConnection: Connection): Cardinal
def connection_ip(a_connection):
Connection IP
Gets the ip address of the connection with the supplied name.
- Return Type
-
Unsigned Integer
The connection's ip address
- Parameters
-
Name Type Description Name String
The name of the connection
- Signatures
-
unsigned int connection_ip(const string &name)
public static uint Networking.ConnectionIP(string name); public static uint SplashKit.ConnectionIP(string name);
function ConnectionIP(const name: String): Cardinal
def connection_ip_from_name(name):
Connection Named
Fetch the connection with the indicated name.
- Return Type
-
The connection with that name
- Parameters
-
Name Type Description Name String
The name of the connection to fetch
- Signatures
-
connection connection_named(const string &name)
public static Connection Networking.ConnectionNamed(string name); public static Connection SplashKit.ConnectionNamed(string name);
function ConnectionNamed(const name: String): Connection
def connection_named(name):
Connection Port
Connection Port
Gets the port of the connection.
- Return Type
-
Unsigned Short
The port of the connection.
- Parameters
-
Name Type Description A Connection The connection
- Signatures
-
unsigned short connection_port(connection a_connection)
public ushort Connection.Port { get } public static ushort SplashKit.ConnectionPort(Connection aConnection);
function ConnectionPort(aConnection: Connection): Word
def connection_port(a_connection):
Connection Port
Gets the part of the connection.
- Return Type
-
Unsigned Short
The port of the connection
- Parameters
-
Name Type Description Name String
The name of the connection
- Signatures
-
unsigned short connection_port(const string &name)
public static ushort Networking.ConnectionPort(string name); public static ushort SplashKit.ConnectionPort(string name);
function ConnectionPort(const name: String): Word
def connection_port_from_name(name):
Create Server
Create Server
Creates a new TCP server that can accept connections from other programs.
- Return Type
-
A new server with the indicated details
- Parameters
-
Name Type Description Name String
The name used to access the Server in splashkit
Port Unsigned Short
The port that clients will use to connect to the server
- Signatures
-
server_socket create_server(const string &name, unsigned short port)
public static ServerSocket SplashKit.CreateServer(string name, ushort port); public ServerSocket(string name, ushort port);
function CreateServer(const name: String; port: Word): ServerSocket
def create_server_with_port(name, port):
Create Server
Creates a new server that can accept connections from other programs.
- Return Type
-
A new server with the indicated details
- Parameters
-
Name Type Description Name String
The name used to access the Server in splashkit
Port Unsigned Short
The port that clients will use to connect to the server
Protocol The protocol used by the server
- Signatures
-
server_socket create_server(const string &name, unsigned short port, connection_type protocol)
public static ServerSocket SplashKit.CreateServer(string name, ushort port, ConnectionType protocol); public ServerSocket(string name, ushort port, ConnectionType protocol);
function CreateServer(const name: String; port: Word; protocol: ConnectionType): ServerSocket
def create_server_with_port_and_protocol(name, port, protocol):
Decimal To Hexadecimal
Converts the supplied decimal integer into it's hexadecimal representation. e.g. 0x7F000001 from 2130706433
- Return Type
-
String
hexadecimal representation of the supplied decimal integer
- Parameters
-
Name Type Description A Decimal Unsigned Integer
decimal to be converted to a hexadecimal number string
- Signatures
-
string dec_to_hex(unsigned int a_dec)
public static string Networking.DecToHex(uint aDec); public static string SplashKit.DecToHex(uint aDec);
function DecToHex(aDec: Cardinal): String
def dec_to_hex(a_dec):
Fetch New Connection
Get the oldest new connections made to the server, and reduces the new connection count by 1.
- Return Type
-
The oldest new connection
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
connection fetch_new_connection(server_socket server)
public Connection ServerSocket.FetchNewConnection(); public static Connection SplashKit.FetchNewConnection(ServerSocket server);
function FetchNewConnection(server: ServerSocket): Connection
def fetch_new_connection(server):
Has Connection
Does the connection with the supplied name exist?
- Return Type
-
Boolean
True if there is a connection with the supplied name
- Parameters
-
Name Type Description Name String
The name of the connection to check.
- Signatures
-
bool has_connection(const string &name)
public static bool Networking.HasConnection(string name); public static bool SplashKit.HasConnection(string name);
function HasConnection(const name: String): Boolean
def has_connection(name):
Has Messages
Has Messages
Checks if there are any messages waiting to be read.
- Return Type
-
Boolean
True if there are any messages waiting to be read
- Signatures
-
bool has_messages()
public static bool Networking.HasMessages { get } public static bool SplashKit.HasMessages();
function HasMessages(): Boolean
def has_messages():
Has Messages
Checks if a connection has messages waiting to be read.
- Return Type
-
Boolean
True if there are any messages on the connection.
- Parameters
-
Name Type Description Con The connection
- Signatures
-
bool has_messages(connection con)
public bool Connection.HasMessages { get } public static bool SplashKit.HasMessages(Connection con);
function HasMessages(con: Connection): Boolean
def has_messages_on_connection(con):
Has Messages
Checks if a server or connection has any messages.
- Return Type
-
Boolean
[description]
- Parameters
-
Name Type Description Name String
The name of the server or connection to check.
- Signatures
-
bool has_messages(const string &name)
public static bool Networking.HasMessages(string name); public static bool SplashKit.HasMessages(string name);
function HasMessages(const name: String): Boolean
def has_messages_on_name(name):
Has Messages
Checks if a server has any messages waiting to be read.
- Return Type
-
Boolean
True if there are messages on the server.
- Parameters
-
Name Type Description Svr The server to check
- Signatures
-
bool has_messages(server_socket svr)
public bool ServerSocket.HasMessages { get } public static bool SplashKit.HasMessages(ServerSocket svr);
function HasMessages(svr: ServerSocket): Boolean
def has_messages_on_server(svr):
Has New Connections
Checks if any of the servers have new connections.
- Return Type
-
Boolean
True if there is one or more servers with new connections.
- Signatures
-
bool has_new_connections()
public static bool Networking.HasNewConnections(); public static bool SplashKit.HasNewConnections();
function HasNewConnections(): Boolean
def has_new_connections():
Has Server
Checks if there is a server with the indicated name.
- Return Type
-
Boolean
True if there is a server with that name
- Parameters
-
Name Type Description Name String
The name of the server to check
- Signatures
-
bool has_server(const string &name)
public static bool Networking.HasServer(string name); public static bool SplashKit.HasServer(string name);
function HasServer(const name: String): Boolean
def has_server(name):
Hexadecimal Str To IPv4
The supplied hexadecimal string is translated into ipv4 standard address string. Function handles hex strings starting with or without 0x. e.g. 127.0.0.1 from 0x7F000001
- Return Type
-
String
standard ipv4 address using format X.X.X.X
- Parameters
-
Name Type Description A Hexadecimal String
hexadecimal ipv4 string to convert
- Signatures
-
string hex_str_to_ipv4(const string &a_hex)
public static string Networking.HexStrToIpv4(string aHex); public static string SplashKit.HexStrToIpv4(string aHex);
function HexStrToIpv4(const aHex: String): String
def hex_str_to_ipv4(a_hex):
Hexadecimal To Decimal String
The supplied hexadecimal string is converted into it's decimal representation e.g. 7F into 127
- Return Type
-
String
decimal representation of supplied hex string
- Parameters
-
Name Type Description A Hexadecimal String
hexadecimal string to convert
- Signatures
-
string hex_to_dec_string(const string &a_hex)
public static string Networking.HexToDecString(string aHex); public static string SplashKit.HexToDecString(string aHex);
function HexToDecString(const aHex: String): String
def hex_to_dec_string(a_hex):
IPv4 To Decimal
Encodes the supplied ipv4 address string (in format X.X.X.X) into a single integer e.g. 127.0.0.1 into 2130706433
- Return Type
-
Unsigned Integer
encoded ipv4 string
- Parameters
-
Name Type Description A IP String
ipv4 address to encode
- Signatures
-
unsigned int ipv4_to_dec(const string &a_ip)
public static uint Networking.Ipv4ToDec(string aIP); public static uint SplashKit.Ipv4ToDec(string aIP);
function Ipv4ToDec(const aIP: String): Cardinal
def ipv4_to_dec(a_ip):
IPv4 To Hexadecimal
Converts an ipv4 address into it's hexadecimal representation e.g. 0x7F000001 from 127.0.0.1
- Return Type
-
String
hexadecimal representation of ipc4 string
- Parameters
-
Name Type Description A IP String
ip address to convert
- Signatures
-
string ipv4_to_hex(const string &a_ip)
public static string Networking.Ipv4ToHex(string aIP); public static string SplashKit.Ipv4ToHex(string aIP);
function Ipv4ToHex(const aIP: String): String
def ipv4_to_hex(a_ip):
IPv4 To Str
Decodes the supplied unsigned 32 bit integer into it's ipv4 address form e.g. 2130706433 into 127.0.0.1
- Return Type
-
String
ipv4 address string in X.X.X.X format
- Parameters
-
Name Type Description IP Unsigned Integer
integer to be decoded
- Signatures
-
string ipv4_to_str(unsigned int ip)
public static string Networking.Ipv4ToStr(uint ip); public static string SplashKit.Ipv4ToStr(uint ip);
function Ipv4ToStr(ip: Cardinal): String
def ipv4_to_str(ip):
Is Connection Open
Is Connection Open
Checks if the connection currently is open.
- Return Type
-
Boolean
True if the connection is open.
- Parameters
-
Name Type Description Con The connection
- Signatures
-
bool is_connection_open(connection con)
public bool Connection.IsOpen { get } public static bool SplashKit.IsConnectionOpen(Connection con);
function IsConnectionOpen(con: Connection): Boolean
def is_connection_open(con):
Is Connection Open
Checks if the connection with the supplied name currently is open.
- Return Type
-
Boolean
True if the connection is open.
- Parameters
-
Name Type Description Name String
The name of the connection
- Signatures
-
bool is_connection_open(const string &name)
public static bool Networking.IsConnectionOpen(string name); public static bool SplashKit.IsConnectionOpen(string name);
function IsConnectionOpen(const name: String): Boolean
def is_connection_open_from_name(name):
Last Connection
Last Connection
Gets the last client that connected to a server.
- Return Type
-
The last connection made to that server
- Parameters
-
Name Type Description Name String
The name of the server to check
- Signatures
-
connection last_connection(const string &name)
public static Connection Networking.LastConnection(string name); public static Connection SplashKit.LastConnection(string name);
function LastConnection(const name: String): Connection
def last_connection_named(name):
Last Connection
Gets the last client that connected to a server.
- Return Type
-
The last connection made to that server
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
connection last_connection(server_socket server)
public Connection ServerSocket.LastConnection { get } public static Connection SplashKit.LastConnection(ServerSocket server);
function LastConnection(server: ServerSocket): Connection
def last_connection(server):
Message Connection
Returns the connection that sent a message.
- Return Type
-
The connection that sent the message
- Parameters
-
Name Type Description Msg The message
- Signatures
-
connection message_connection(message msg)
public static Connection Networking.MessageConnection(Message msg); public static Connection SplashKit.MessageConnection(Message msg);
function MessageConnection(msg: Message): Connection
def message_connection(msg):
Message Count
Message Count
Returns the number of messages on a server.
- Return Type
-
Unsigned Integer
The number of messages on the server
- Parameters
-
Name Type Description Svr The server to check
- Signatures
-
unsigned int message_count(server_socket svr)
public uint ServerSocket.MessageCount { get } public static uint SplashKit.MessageCount(ServerSocket svr);
function MessageCount(svr: ServerSocket): Cardinal
def message_count_on_server(svr):
Message Count
Returns the number of messages on a connection.
- Return Type
-
Unsigned Integer
The number of messages to be read from the connection
- Parameters
-
Name Type Description A Connection The connection
- Signatures
-
unsigned int message_count(connection a_connection)
public uint Connection.MessageCount { get } public static uint SplashKit.MessageCount(Connection aConnection);
function MessageCount(aConnection: Connection): Cardinal
def message_count_on_connection(a_connection):
Message Count
Returns the number of messages on a server or connection.
- Return Type
-
Unsigned Integer
The number of messages on the server or connection
- Parameters
-
Name Type Description Name String
The name of the server or connection
- Signatures
-
unsigned int message_count(const string &name)
public static uint Networking.MessageCount(string name); public static uint SplashKit.MessageCount(string name);
function MessageCount(const name: String): Cardinal
def message_count_from_name(name):
Message Data
Gets the body of a message as a string.
- Return Type
-
String
The string body of the message
- Parameters
-
Name Type Description Msg The message to check
- Signatures
-
string message_data(message msg)
public string Message.Data { get } public static string SplashKit.MessageData(Message msg);
function MessageData(msg: Message): String
def message_data(msg):
Message Data Bytes
Gets the body of a message as a list of bytes.
- Return Type
-
Dynamic Array
The body of the message as bytes
- Parameters
-
Name Type Description Msg The message to check
- Signatures
-
vector<int8_t> message_data_bytes(message msg)
public List<byte> Message.DataBytes { get } public static List<byte> SplashKit.MessageDataBytes(Message msg);
function MessageDataBytes(msg: Message): ArrayOfChar
def message_data_bytes(msg):
Message Host
Returns the host who made the message.
- Return Type
-
String
The host who sent the message
- Parameters
-
Name Type Description Msg The message to check
- Signatures
-
string message_host(message msg)
public string Message.Host { get } public static string SplashKit.MessageHost(Message msg);
function MessageHost(msg: Message): String
def message_host(msg):
Message Port
Returns the port used to send a message.
- Return Type
-
Unsigned Short
The port of the message
- Parameters
-
Name Type Description Msg The message to check
- Signatures
-
unsigned short message_port(message msg)
public ushort Message.Port { get } public static ushort SplashKit.MessagePort(Message msg);
function MessagePort(msg: Message): Word
def message_port(msg):
Message Protocol
Returns the protocol used to send a message.
- Return Type
-
The protocol used to sent the message
- Parameters
-
Name Type Description Msg The message to check
- Signatures
-
connection_type message_protocol(message msg)
public ConnectionType Message.Protocol { get } public static ConnectionType SplashKit.MessageProtocol(Message msg);
function MessageProtocol(msg: Message): ConnectionType
def message_protocol(msg):
My IP
Returns the ipv4 string of the localhost loopback for the current computer.
- Return Type
-
String
ipv4 address string in X.X.X.X format
- Signatures
-
string my_ip()
public static string Networking.MyIP(); public static string SplashKit.MyIP();
function MyIP(): String
def my_ip():
Name For Connection
Returns the name SplashKit would use for a connection made to a server from a host to a port.
- Return Type
-
String
The name SplashKit would use for this connection
- Parameters
-
Name Type Description Host String
The host name
Port Unsigned Integer
The port
- Signatures
-
string name_for_connection(const string host, const unsigned int port)
public static string Networking.NameForConnection(string host, uint port); public static string SplashKit.NameForConnection(string host, uint port);
function NameForConnection(host: String; port: Cardinal): String
def name_for_connection(host, port):
New Connection Count
Get the number of new connections made to the server. The count will increase as the server accepts new connections. The count decreases each time you fetch a new connection, or can be set to 0 if you reset the new connection count.
- Return Type
-
Integer
The number of new connections
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
int new_connection_count(server_socket server)
public int ServerSocket.NewConnectionCount { get } public static int SplashKit.NewConnectionCount(ServerSocket server);
function NewConnectionCount(server: ServerSocket): Integer
def new_connection_count(server):
Open Connection
Open Connection
Opens a TCP connection to a server using the supplied details.
- Return Type
-
A new connection to the indicated server
- Parameters
-
Name Type Description Name String
The name for the connection
Host String
The address of the server
Port Unsigned Short
The server's port
- Signatures
-
connection open_connection(const string &name, const string &host, unsigned short port)
public static Connection SplashKit.OpenConnection(string name, string host, ushort port); public Connection(string name, string host, ushort port);
function OpenConnection(const name: String; const host: String; port: Word): Connection
def open_connection(name, host, port):
Open Connection
Opens a connection to a server using the supplied details.
- Return Type
-
A new connection to the indicated server
- Parameters
-
Name Type Description Name String
The name for the connection
Host String
The address of the server
Port Unsigned Short
The server's port
Protocol The protocol used to connect to the server
- Signatures
-
connection open_connection(const string &name, const string &host, unsigned short port, connection_type protocol)
public static Connection SplashKit.OpenConnection(string name, string host, ushort port, ConnectionType protocol); public Connection(string name, string host, ushort port, ConnectionType protocol);
function OpenConnection(const name: String; const host: String; port: Word; protocol: ConnectionType): Connection
def open_connection_with_protocol(name, host, port, protocol):
Read Message
Read Message
Read a message from the network (from a server or connection).
- Return Type
-
The first message from the network.
- Signatures
-
message read_message()
public static Message Networking.ReadMessage(); public static Message SplashKit.ReadMessage();
function ReadMessage(): Message
def read_message():
Read Message
Reads the first message from the connection.
- Return Type
-
The first message read from the connection
- Parameters
-
Name Type Description A Connection A connection
- Signatures
-
message read_message(connection a_connection)
public Message Connection.ReadMessage(); public static Message SplashKit.ReadMessage(Connection aConnection);
function ReadMessage(aConnection: Connection): Message
def read_message_from_connection(a_connection):
Read Message
Reads the first message from a connection or server.
- Return Type
-
The first message read from the connection or server
- Parameters
-
Name Type Description Name String
The name of a connection or server
- Signatures
-
message read_message(const string &name)
public static Message Networking.ReadMessage(string name); public static Message SplashKit.ReadMessage(string name);
function ReadMessage(const name: String): Message
def read_message_from_name(name):
Read Message
Reads the first message from the server.
- Return Type
-
The first message read from the server
- Parameters
-
Name Type Description Svr A server
- Signatures
-
message read_message(server_socket svr)
public Message ServerSocket.ReadMessage(); public static Message SplashKit.ReadMessage(ServerSocket svr);
function ReadMessage(svr: ServerSocket): Message
def read_message_from_server(svr):
Read Message Data
Read Message Data
Read message data from a connection or server.
- Return Type
-
String
The data from the first message from the server or connection
- Parameters
-
Name Type Description Name String
The name of the connection or server
- Signatures
-
string read_message_data(const string &name)
public static string Networking.ReadMessageData(string name); public static string SplashKit.ReadMessageData(string name);
function ReadMessageData(const name: String): String
def read_message_data_from_name(name):
Read Message Data
Read message data from a connection.
- Return Type
-
String
The data from the first message on the connection
- Parameters
-
Name Type Description A Connection The connection
- Signatures
-
string read_message_data(connection a_connection)
public string Connection.ReadMessageData(); public static string SplashKit.ReadMessageData(Connection aConnection);
function ReadMessageData(aConnection: Connection): String
def read_message_data_from_connection(a_connection):
Read Message Data
Read message data from a server.
- Return Type
-
String
The data from the first message on the server
- Parameters
-
Name Type Description Svr The server
- Signatures
-
string read_message_data(server_socket svr)
public string ServerSocket.ReadMessageData(); public static string SplashKit.ReadMessageData(ServerSocket svr);
function ReadMessageData(svr: ServerSocket): String
def read_message_data_from_server(svr):
Reconnect
Reconnect
Attempt to reconnect the connection.
- Parameters
-
Name Type Description A Connection The connection to reconnect
- Signatures
-
void reconnect(connection a_connection)
public void Connection.Reconnect(); public static void SplashKit.Reconnect(Connection aConnection);
procedure Reconnect(aConnection: Connection)
def reconnect(a_connection):
Reconnect
Attempt to reconnect the connection.
- Parameters
-
Name Type Description Name String
The name of the connection to reconnect.
- Signatures
-
void reconnect(const string &name)
public static void Networking.Reconnect(string name); public static void SplashKit.Reconnect(string name);
procedure Reconnect(const name: String)
def reconnect_from_name(name):
Release All Connections
Close and release the resources used by all of the connections.
- Signatures
-
void release_all_connections()
public static void Networking.ReleaseAllConnections(); public static void SplashKit.ReleaseAllConnections();
procedure ReleaseAllConnections()
def release_all_connections():
Reset New Connection Count
Allows you to reset the new connection count to 0. (The connections are kept)
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
void reset_new_connection_count(server_socket server)
public void ServerSocket.ResetNewConnectionCount(); public static void SplashKit.ResetNewConnectionCount(ServerSocket server);
procedure ResetNewConnectionCount(server: ServerSocket)
def reset_new_connection_count(server):
Retrieve Connection
Retrieve Connection
Get a connection from the server.
- Return Type
-
The connection at the supplied index
- Parameters
-
Name Type Description Name String
The name of the server
Idx Integer
The index of the connection
- Signatures
-
connection retrieve_connection(const string &name, int idx)
public static Connection Networking.RetrieveConnection(string name, int idx); public static Connection SplashKit.RetrieveConnection(string name, int idx);
function RetrieveConnection(const name: String; idx: Integer): Connection
def retrieve_connection_named(name, idx):
Retrieve Connection
Get a connection from the server.
- Return Type
-
The connection at the supplied index
- Parameters
-
Name Type Description Server The server
Idx Integer
The index of the connection
- Signatures
-
connection retrieve_connection(server_socket server, int idx)
public Connection ServerSocket.RetrieveConnection(int idx); public static Connection SplashKit.RetrieveConnection(ServerSocket server, int idx);
function RetrieveConnection(server: ServerSocket; idx: Integer): Connection
def retrieve_connection(server, idx):
Send Message To
Send Message To
Send a message to the connection.
- Return Type
-
Boolean
True if the message sends.
- Parameters
-
Name Type Description A Msg String
The message to send
A Connection The connection to send the message to
- Signatures
-
bool send_message_to(const string &a_msg, connection a_connection)
public bool Connection.SendMessageTo(string aMsg); public static bool SplashKit.SendMessageTo(string aMsg, Connection aConnection);
function SendMessageTo(const aMsg: String; aConnection: Connection): Boolean
def send_message_to_connection(a_msg, a_connection):
Send Message To
Send a message to the connection with the given name.
- Return Type
-
Boolean
True if the message sends
- Parameters
-
Name Type Description A Msg String
The message to send
Name String
The name of the connection to send the message to
- Signatures
-
bool send_message_to(const string &a_msg, const string &name)
public static bool Networking.SendMessageTo(string aMsg, string name); public static bool SplashKit.SendMessageTo(string aMsg, string name);
function SendMessageTo(const aMsg: String; const name: String): Boolean
def send_message_to_name(a_msg, name):
Server Has New Connection
Server Has New Connection
Checks of there are new connections waiting for a server.
- Return Type
-
Boolean
True if the server has new connections
- Parameters
-
Name Type Description Name String
The name of the server to check
- Signatures
-
bool server_has_new_connection(const string &name)
public static bool Networking.ServerHasNewConnection(string name); public static bool SplashKit.ServerHasNewConnection(string name);
function ServerHasNewConnection(const name: String): Boolean
def server_has_new_connection_named(name):
Server Has New Connection
Checks of there are new connections waiting for a server.
- Return Type
-
Boolean
True if the server has new connections
- Parameters
-
Name Type Description Server The server to check
- Signatures
-
bool server_has_new_connection(server_socket server)
public bool ServerSocket.HasNewConnections { get } public static bool SplashKit.ServerHasNewConnection(ServerSocket server);
function ServerHasNewConnection(server: ServerSocket): Boolean
def server_has_new_connection(server):
Server Named
Gets the server with the indicated name.
- Return Type
-
The server
- Parameters
-
Name Type Description Name String
The name of the server to get
- Signatures
-
server_socket server_named(const string &name)
public static ServerSocket Networking.ServerNamed(string name); public static ServerSocket SplashKit.ServerNamed(string name);
function ServerNamed(const name: String): ServerSocket
def server_named(name):
Set Udp Packet Size
Change the size of the UDP packets.
- Parameters
-
Name Type Description Udp Packet Size Unsigned Integer
The new packet size.
- Signatures
-
void set_udp_packet_size(unsigned int udp_packet_size)
public static void Networking.UDPPacketSize { set } public static void SplashKit.SetUDPPacketSize(uint udpPacketSize);
procedure SetUDPPacketSize(udpPacketSize: Cardinal)
def set_udp_packet_size(udp_packet_size):
Udp Packet Size
Returns the size SplashKit is using for UDP packets.
- Return Type
-
Unsigned Integer
The size of UDP packets.
- Signatures
-
unsigned int udp_packet_size()
public static uint Networking.UDPPacketSize { get } public static uint SplashKit.UDPPacketSize();
function UDPPacketSize(): Cardinal
def udp_packet_size():
Types
Connection
A connection represents the communication channel from a client going to a server. This can be used for the client and the server to send and receive messages.
Connection Type
The kind of protocol used for a server of connection.
- Constants
-
Name Description Tcp Uses the TCP protocol. SplashKit can send messages of any size, and repackage it from you at the other end. Messages are reliably transferred.
Udp Uses the UDP protocol. SplashKit will send messages of up to 1024 bytes (by default). You need to handle packaging anything larger than this.
Unknown The protocol is unknown, usually due to the connection or server being invalid or closed.
HTTP Method
The method token is used to indicate the kind of action to be performed on the server. See W3 specifications.
- Constants
-
Name Description HTTP GET Method A get method
HTTP POST Method A post method
HTTP PUT Method A put method
HTTP DELETE Method A delete method
HTTP Options Method An options method
HTTP Trace Method A trace method
Unknown HTTP Method A method not recognised by SplashKit
HTTP Request
The request contains the details of the resource the user is requesting.
HTTP Response
A HTTP response is a resource that comes back from a HTTP request. This
may be the text related to a web page, or the data related to a resource.
Once you have used the response, you need to make sure to call
Free Response
.
Message
A message contains data that has been transferred between a client connection and a server (or visa versa).
Server Socket
A server represents a network resource that clients can connect to. The server will receive messages from all of the client connections, and can be used to access the clients connected to the server.
Web Server
The web server is able to listen for incomming requests, and you can then provide the response.