NetworkConnection Module

connect(address, port)

Connect to a server at the specified address.

Parameters:
  • address (string) – The address of a server.
  • port (int) – The port the server is listening on
Returns:

The connection to the server.

Return type:

_NetworkConnection

accept(port)

Accepts a connection from a client.

Parameters:port (integer) – The port to accept connections over
Returns:The connection from the client.
Return type:_NetworkConnection
class _NetworkConnection

“Hidden” class that handles the inner workings of a network connection.

send(message)

Sends a string message over the connection.

Parameters:message (string) – a string to send over the connection.
receive()

Recieve a line of text from the socket.

Returns:A message from the socket
Return type:string
close()

Close all connections.

connected()

States whether the current connection is valid.

Returns:True if the connection is valid.
Return type:boolean

Previous topic

Welcome to NetworkConnection’s documentation!

This Page