|
Using TCP/IP and UDP Protocols |
TCP/IP and UDP are two network protocols supported in Sheerpower for sending and receiving data between servers and client computers.
Reliable, connection-oriented. Each message is confirmed by the receiver, and re-sent if corrupted or missing.
Guarantees delivery with automatic retransmission.
Fast, connectionless. Data is sent and may or may not be received. No built-in confirmation or error checking.
Programmer must handle reliability if needed.
Format:
line input #cgi_ch: checks the network work queue for a new request.
If the queue is empty, Sheerpower briefly waits for 10 ms, then checks again.
If the queue is still empty after that, line input returns an empty
string ("").
This approach avoids wasting CPU cycles on tight busy-wait loops, while still
keeping the handler responsive as soon as new work arrives.
line input #cgi_ch:
without ever being forced to wait on the network.
Example 18-4: Very Simple TELNET Client
TCP/IP allows programmers to transmit data back and forth with built-in confirmation of delivery and automatic re-requests if data is garbled.
If an IP address is specified, it denotes the client machine's
destination. If no IP address is specified, the channel acts as a
server. Parameters follow the ? and are separated by
&. For example:
| Parameter | Description | Default |
|---|---|---|
| Sockets | number of sockets to use | 100 |
| port | port number for data transmission | 31111 |
| ipaddress | IP address of the client | none |
| max_receive_queue | max number of requests that can be received | 200 |
| max_send_queue | max number of requests in the send queue | 200 |
| maxdupconnections | maximum duplicate connections allowed | 3 |
| timeout | timeout length in seconds | 50 |
Format:
If an IP address is specified, it denotes the client destination.
Without an IP address, the channel is a server. Parameters follow the
? and are separated by &. For example:
| Parameter | Description | Default |
|---|---|---|
| Sockets | number of sockets to use | 100 |
| port | port number for data transmission | 31111 |
| ipaddress | IP address of the client | none |
| max_receive_queue | max number of requests that can be received | 200 |
| max_send_queue | max number of requests in the send queue | 200 |
| maxdupconnections | maximum duplicate connections allowed | 3 |
| timeout | timeout length in seconds | 50 |
port and timeout give
fine-grained control of connections.|
Hide Description
|
|
|
Enter or modify the code below, and then click on RUN |
|
Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use. |