WIZlib Library API
ver 1.0
WIZlib Library API User Menual
|
Socket Interface. More...
Macros | |
#define | SOCKSTAT_CLOSED -1 |
Indicate the socket is closed state. More... | |
#define | SOCKSTAT_INIT 0 |
Indicate the socket is init state. More... | |
#define | SOCKSTAT_LISTEN 1 |
Indicate the socket is listen state. More... | |
#define | SOCKSTAT_SYNSENT 2 |
Indicate the socket is syn-sent state (momentary state). More... | |
#define | SOCKSTAT_SYNRECV 3 |
Indicate the socket is syn-received state (momentary state). More... | |
#define | SOCKSTAT_ESTABLISHED 4 |
Indicate the socket is established state. More... | |
#define | SOCKSTAT_FIN_WAIT 5 |
Indicate the socket is finish-wait state (momentary state). More... | |
#define | SOCKSTAT_CLOSING 6 |
Indicate the socket is closing state (momentary state). More... | |
#define | SOCKSTAT_TIME_WAIT 7 |
Indicate the socket is time-wait state (momentary state). More... | |
#define | SOCKSTAT_CLOSE_WAIT 8 |
Indicate the socket is close-wait state (momentary state). More... | |
#define | SOCKSTAT_LAST_ACK 9 |
Indicate the socket is last-ack state (momentary state). More... | |
#define | SOCKSTAT_UDP 10 |
Indicate the socket is opened as UDP. More... | |
#define | SOCKERR_BUSY -1 |
Error because the socket is busy. | |
#define | SOCKERR_NOT_TCP -2 |
Error because the socket is not opened as TCP. | |
#define | SOCKERR_NOT_UDP -3 |
Error because the socket is not opened as UDP. | |
#define | SOCKERR_WRONG_ARG -4 |
Error because the parameter is wrong. | |
#define | SOCKERR_WRONG_STATUS -5 |
Error because the socket is unknown state. | |
#define | SOCKERR_CLOSED -6 |
Error because the socket is closed state. | |
#define | SOCKERR_CLOSE_WAIT -7 |
Error because the socket is close wait state. | |
#define | SOCKERR_FIN_WAIT -8 |
Error because the socket is fin wait state. | |
#define | SOCKERR_NOT_ESTABLISHED -9 |
Error because the socket is not established state. | |
#define | SOCKERR_WINDOW_FULL -10 |
Error because of network window full. | |
#define | SOCKERR_TIME_OUT -11 |
Error because of time out. | |
#define | SOCKERR_NULL_SRC_IP -12 |
Error because source IP is wrong. | |
#define | SOCKERR_BUF_NOT_ENOUGH -13 |
Error because buffer is not enough. | |
#define | SOCKERR_NOT_SPECIFIED -14 |
Error because of not specified reason. | |
Functions | |
int8 | TCPServerOpen (uint8 s, uint16 port) |
Open a TCP server socket. More... | |
int8 | TCPClientOpen (uint8 s, uint16 sport, uint8 *dip, uint16 dport) |
Open a TCP client socket. More... | |
int8 | TCPCltOpenNB (uint8 s, uint16 sport, uint8 *dip, uint16 dport) |
Open a TCP client socket without blocking. More... | |
int8 | TCPConnChk (uint8 s) |
Check if a TCP Socket is connected. More... | |
int8 | TCPClose (uint8 s) |
Close a TCP socket. More... | |
int8 | TCPCloseNB (uint8 s) |
Close a TCP socket without blocking. More... | |
int8 | TCPCloseCHK (uint8 s) |
Check if a TCP Socket is closed. More... | |
int8 | TCPClsRcvCHK (uint8 s) |
Check TCP Connection Close which is not intentional. More... | |
int32 | TCPSend (uint8 s, const int8 *buf, uint16 len) |
Send the data in TCP mode. More... | |
int8 | TCPSendNB (uint8 s, const int8 *buf, uint16 len) |
Send the data in TCP mode without blocking. More... | |
int32 | TCPReSend (uint8 s) |
Re-Send the data in TCP mode. More... | |
int8 | TCPReSendNB (uint8 s) |
Re-Send the data in TCP mode without blocking. More... | |
int32 | TCPSendCHK (uint8 s) |
Check if TCP Send action completed. More... | |
int32 | TCPRecv (uint8 s, int8 *buf, uint16 len) |
Receive the data in TCP mode. More... | |
int8 | UDPOpen (uint8 s, uint16 port) |
Open a UDP socket. More... | |
int8 | UDPClose (uint8 s) |
Close a UDP socket. More... | |
int32 | UDPSend (uint8 s, const int8 *buf, uint16 len, uint8 *addr, uint16 port) |
Send the data in UDP mode. More... | |
int32 | UDPSendNB (uint8 s, const int8 *buf, uint16 len, uint8 *addr, uint16 port) |
Send the data in UDP mode without blocking. More... | |
int8 | UDPSendCHK (uint8 s) |
Check if UDP Send action completed. More... | |
int32 | UDPRecv (uint8 s, int8 *buf, uint16 len, uint8 *addr, uint16 *port) |
Receive the data in UDP mode. More... | |
int8 | GetTCPSocketStatus (uint8 s) |
Get the TCP socket status. More... | |
int8 | GetUDPSocketStatus (uint8 s) |
Get the UDP socket status. More... | |
uint16 | GetSocketTxFreeBufferSize (uint8 s) |
Get the TX free buffer size. More... | |
uint16 | GetSocketRxRecvBufferSize (uint8 s) |
Get the RX recv buffer size. More... | |
void | GetDstInfo (uint8 s, uint8 *dstip, uint16 *dstport) |
Get Destination Information. More... | |
void | SetSocketOption (uint8 option_type, uint16 option_value) |
Set the network option. More... | |
Socket Interface.
#define SOCKSTAT_CLOSE_WAIT 8 |
Indicate the socket is close-wait state (momentary state).
It is the status that disconnect-request (FIN packet) is received
from the peer As TCP connection is half-closed, it is possible
to transfer data packet. In order to complete the TCP disconnection,
DISCON command should be performed.
For SOCKETn close without disconnection-process, CLOSE
command should be just performed.
#define SOCKSTAT_CLOSED -1 |
Indicate the socket is closed state.
It is the status that resource of SOCKETn is released.
When DISCON or CLOSE command is performed, or ARPTO, or TCPTO occurs,
it is changed to SOCK_CLOSED regardless of previous value.
#define SOCKSTAT_CLOSING 6 |
Indicate the socket is closing state (momentary state).
These status shows that Socket n is closed. It is observed
in the disconnect-process of active close or passive close.
It is changed to SOCK_CLOSED, when disconnect-process is
successfully finished or TCPTO occurs (Sn_IR (TIMEOUT) ='1').
#define SOCKSTAT_ESTABLISHED 4 |
Indicate the socket is established state.
It is shown in case that connection is established.
It is changed to SOCK_ESTABLISHED when SYN packet from
"TCP CLIENT" is successfully processed at the SOCK_LISTEN, or
CONNECTS command is successfully performed. At this status,
DATA packet can be transferred, that is, SEND or RECV command
can be performed.
#define SOCKSTAT_FIN_WAIT 5 |
Indicate the socket is finish-wait state (momentary state).
These status shows that Socket n is closed. It is observed
in the disconnect-process of active close or passive close.
It is changed to SOCK_CLOSED, when disconnect-process is
successfully finished or TCPTO occurs (Sn_IR (TIMEOUT)='1').
#define SOCKSTAT_INIT 0 |
Indicate the socket is init state.
It is shown in case that Sn_MR is set as TCP and OPEN
commands are given to Sn_CR. It is changed to SOCK_INIT
when Sn_MR (P3:P0) is Sn_MR_TCP and OPEN command is
performed. It is the initial step of TCP connection establishment.
It is possible to perform LISTEN command at the "TCP SERVER"
mode and CONNECT command at the "TCP CLIENT".
It is the status that SOCKETn operates as "TCP SERVER" and
waits for connect-request (SYN packet) from "TCP CLIENT".
#define SOCKSTAT_LAST_ACK 9 |
Indicate the socket is last-ack state (momentary state).
These status shows that Socket n is closed. It is observed
in the disconnect-process of active close or passive close.
It is changed to SOCK_CLOSED, when disconnect-process
is successfully finished or TCPTO occurs (Sn_IR (TIMEOUT)='1').
#define SOCKSTAT_LISTEN 1 |
Indicate the socket is listen state.
Socket n operates in TCP Server Mode and waits for a
connection-request (SYN packet) from a “TCP CLIENT”.
When the LISTEN command is used, the stage changes to SOCK_LISTEN
Once the connection is established, the SOCKET state
changes from SOCK_LISTEN to SOCK_ESTABLISHED; however,
if the connection fails, TCPTO occurs (Sn_IR(TIME_OUT) ='1') and
the state changes to SOCK_CLOSED.
#define SOCKSTAT_SYNRECV 3 |
Indicate the socket is syn-received state (momentary state).
This status indicate that a connect-request(SYN packet) is
received from a "TCP CLIENT". It is automatically changed
to SOCK_ESTABLISHED when W5200 successfully transmits
connect-accept (SYN/ACK packet) to the "TCP CLIENT".
If it is failed, TCPTO occurs (Sn_IR(TIMEOUT)=‘1’),
and it is changed to SOCK_CLOSED
#define SOCKSTAT_SYNSENT 2 |
Indicate the socket is syn-sent state (momentary state).
This status indicates that a connect-request (SYN packet) is
sent to a "TCP SERVER". This status shows changing process
from SOCK_INIT to SOCK_ESTABLISHED by CONNECT
command. At this status, if connect-accept (SYN/ACK packet)
is received from "TCP SERVER", it is automatically
changed to SOCK_ ESTBLISHED. If SYN/ACK packet is not
received from the "TCP SERVER" before TCPTO occurs
(Sn_IR(TIMEOUT)=‘1’), it is changed to SOCK_CLOSED.
#define SOCKSTAT_TIME_WAIT 7 |
Indicate the socket is time-wait state (momentary state).
These status shows that Socket n is closed. It is oserved
in the disconnect-process of active close or passive close. It
is changed to SOCK_CLOSED, when disconnect-process is
successfully finished or TCPTO occurs (Sn_IR (TIMEOUT)='1').
#define SOCKSTAT_UDP 10 |
Indicate the socket is opened as UDP.
It is the status that SOCKETn is open as UDP mode. It is
changed to SOCK_UDP when Sn_MR(P3:P0) is Sn_MR_UDP
and OPEN command is performed. DATA packet can be
transferred without connection that is necessary to TCP mode SOCKET.
void GetDstInfo | ( | uint8 | s, |
uint8 * | dstip, | ||
uint16 * | dstport | ||
) |
Get Destination Information.
When connected with remote through TCP or received packet through UDP,
You can get the destination IP Address and Port by using this.
s | The socket number to get address |
dstip | The array pointer in which IP address will enter |
dstport | The variable pointer in which Port number will enter |
Definition at line 158 of file w5200/socket.c.
uint16 GetSocketRxRecvBufferSize | ( | uint8 | s | ) |
Get the RX recv buffer size.
s | The socket number you want to get |
Definition at line 234 of file w5200/socket.c.
uint16 GetSocketTxFreeBufferSize | ( | uint8 | s | ) |
Get the TX free buffer size.
s | The socket number you want to get |
Definition at line 229 of file w5200/socket.c.
int8 GetTCPSocketStatus | ( | uint8 | s | ) |
Get the TCP socket status.
s | The socket number you want to get |
Definition at line 181 of file w5200/socket.c.
int8 GetUDPSocketStatus | ( | uint8 | s | ) |
Get the UDP socket status.
s | The socket number you want to get |
Definition at line 207 of file w5200/socket.c.
void SetSocketOption | ( | uint8 | option_type, |
uint16 | option_value | ||
) |
Set the network option.
option_type |
|
option_value | The value you want to set |
Definition at line 164 of file w5200/socket.c.
int8 TCPClientOpen | ( | uint8 | s, |
uint16 | sport, | ||
uint8 * | dip, | ||
uint16 | dport | ||
) |
Open a TCP client socket.
s | The socket number you want to open |
sport | The source port number you want to open |
dip | Destination IP Address |
dport | Destination Port Number |
Definition at line 271 of file w5200/socket.c.
int8 TCPClose | ( | uint8 | s | ) |
Close a TCP socket.
s | The socket number you want to close |
Definition at line 366 of file w5200/socket.c.
int8 TCPCloseCHK | ( | uint8 | s | ) |
Check if a TCP Socket is closed.
s | The socket number you want to check |
Definition at line 400 of file w5200/socket.c.
int8 TCPCloseNB | ( | uint8 | s | ) |
Close a TCP socket without blocking.
s | The socket number you want to close |
Definition at line 381 of file w5200/socket.c.
int8 TCPClsRcvCHK | ( | uint8 | s | ) |
Check TCP Connection Close which is not intentional.
s | The socket number you want to check |
Definition at line 423 of file w5200/socket.c.
int8 TCPCltOpenNB | ( | uint8 | s, |
uint16 | sport, | ||
uint8 * | dip, | ||
uint16 | dport | ||
) |
Open a TCP client socket without blocking.
s | The socket number you want to open |
sport | The source port number you want to open |
dip | Destination IP Address |
dport | Destination Port Number |
Definition at line 286 of file w5200/socket.c.
int8 TCPConnChk | ( | uint8 | s | ) |
Check if a TCP Socket is connected.
s | The socket number you want to check |
Definition at line 346 of file w5200/socket.c.
int32 TCPRecv | ( | uint8 | s, |
int8 * | buf, | ||
uint16 | len | ||
) |
Receive the data in TCP mode.
s | The socket number you want to receive |
buf | The data you want to receive |
len | buf size |
Definition at line 564 of file w5200/socket.c.
int32 TCPReSend | ( | uint8 | s | ) |
Re-Send the data in TCP mode.
You can use this when TCPSend could not send all of data.
s | The socket number you want to send |
Definition at line 496 of file w5200/socket.c.
int8 TCPReSendNB | ( | uint8 | s | ) |
Re-Send the data in TCP mode without blocking.
You can use this when TCPSend could not send all of data.
s | The socket number you want to send |
Definition at line 514 of file w5200/socket.c.
int32 TCPSend | ( | uint8 | s, |
const int8 * | buf, | ||
uint16 | len | ||
) |
Send the data in TCP mode.
s | The socket number you want to send |
buf | The data you want to send |
len | Length of the data to send |
Definition at line 445 of file w5200/socket.c.
int32 TCPSendCHK | ( | uint8 | s | ) |
Check if TCP Send action completed.
s | The socket number you want to check |
Definition at line 544 of file w5200/socket.c.
int8 TCPSendNB | ( | uint8 | s, |
const int8 * | buf, | ||
uint16 | len | ||
) |
Send the data in TCP mode without blocking.
s | The socket number you want to send |
buf | The data you want to send |
len | Length of the data to send |
Definition at line 463 of file w5200/socket.c.
int8 TCPServerOpen | ( | uint8 | s, |
uint16 | port | ||
) |
Open a TCP server socket.
s | The socket number you want to open |
port | The port number you want to open |
Definition at line 239 of file w5200/socket.c.
int8 UDPClose | ( | uint8 | s | ) |
Close a UDP socket.
s | The socket number you want to close |
Definition at line 618 of file w5200/socket.c.
int8 UDPOpen | ( | uint8 | s, |
uint16 | port | ||
) |
Open a UDP socket.
s | The socket number you want to open |
port | The port number you want to open |
Definition at line 594 of file w5200/socket.c.
int32 UDPRecv | ( | uint8 | s, |
int8 * | buf, | ||
uint16 | len, | ||
uint8 * | addr, | ||
uint16 * | port | ||
) |
Receive the data in UDP mode.
s | The socket number you want to receive |
buf | The data you want to receive |
len | buf size |
addr | The IP Address of peer |
port | The Port Number of peer |
Definition at line 718 of file w5200/socket.c.
int32 UDPSend | ( | uint8 | s, |
const int8 * | buf, | ||
uint16 | len, | ||
uint8 * | addr, | ||
uint16 | port | ||
) |
Send the data in UDP mode.
s | The socket number you want to send |
buf | The data you want to send |
len | Length of the data to send |
addr | The IP Address of peer |
port | The Port Number of peer |
Definition at line 632 of file w5200/socket.c.
int8 UDPSendCHK | ( | uint8 | s | ) |
Check if UDP Send action completed.
s | The socket number you want to check |
Definition at line 701 of file w5200/socket.c.
int32 UDPSendNB | ( | uint8 | s, |
const int8 * | buf, | ||
uint16 | len, | ||
uint8 * | addr, | ||
uint16 | port | ||
) |
Send the data in UDP mode without blocking.
s | The socket number you want to send |
buf | The data you want to send |
len | Length of the data to send |
addr | The IP Address of peer |
port | The Port Number of peer |
Definition at line 647 of file w5200/socket.c.