Wal Network Engine is a simple class that manages all network operations. When working with the Wal API you will probably not use the network class but here its just in case it is needed for a particular task.
Here is a simple example of this class:
sock = WalNetwork(TCP, 10, NO) # TCP = 1, for UDP = 2, 10 is timeout, 0
(NO) no ssl, to enable SSL set to 1 (YES)
sock.open_socket()
sock.connect(127.0.0.1, 80)
sock.send_socket_data(mydata) # mydata is a string
sock.close_socket()
Functions List
Function Name: def open_socket()
Parameters: Nothing
Return: 1 on success, 0 (zero) on error.
Abstract: Opens a socket.
Function Name: def connect_socket(host, port)
Parameters: host, port
Return: Socket descriptor
Abstract: Connects socket to host and port defined.
Function Name: def close_socket()
Parameters: Nothing
Return: Nothing
Abstract: Closes the socket descriptor.
Function Name: def send_socket_data(data)
Parameters: data string
Return: Sent data size
Abstract: Sends data through the socket.
Function Name: def recv_socket_data(size=1000)
Parameters: size (default value is 1000)
Return: String with the received data
Abstract: Receives data through the socket.
Function Name: def socket_makefile()
Parameters: Nothing
Return:
Abstract:
Function Name: def give_socket()
Parameters: Nothing
Return: Socket descriptor
Abstract: Returns the socket descriptor.
Function Name: def set_bind_data()
Parameters: host, port
Return: Nothing
Abstract: Set local source port.
Function Name: def set_socket()
Parameters: socket
Return: Nothing
Abstract: Set socket descriptor.