97#define SOCK_FATAL -1000
100#define SOCKERR_SOCKNUM (SOCK_ERROR - 1)
101#define SOCKERR_SOCKOPT (SOCK_ERROR - 2)
102#define SOCKERR_SOCKINIT (SOCK_ERROR - 3)
103#define SOCKERR_SOCKCLOSED (SOCK_ERROR - 4)
104#define SOCKERR_SOCKMODE (SOCK_ERROR - 5)
105#define SOCKERR_SOCKFLAG (SOCK_ERROR - 6)
106#define SOCKERR_SOCKSTATUS (SOCK_ERROR - 7)
107#define SOCKERR_ARG (SOCK_ERROR - 10)
108#define SOCKERR_PORTZERO (SOCK_ERROR - 11)
109#define SOCKERR_IPINVALID (SOCK_ERROR - 12)
110#define SOCKERR_TIMEOUT (SOCK_ERROR - 13)
111#define SOCKERR_DATALEN (SOCK_ERROR - 14)
112#define SOCKERR_BUFFER (SOCK_ERROR - 15)
114#define SOCKFATAL_PACKLEN (SOCK_FATAL - 1)
119#define SF_ETHER_OWN (Sn_MR_MFEN)
120#define SF_IGMP_VER2 (Sn_MR_MC)
121#define SF_TCP_NODELAY (Sn_MR_ND)
122#define SF_MULTI_ENABLE (Sn_MR_MULTI)
125#define SF_BROAD_BLOCK (Sn_MR_BCASTB)
126#define SF_MULTI_BLOCK (Sn_MR_MMB)
127#define SF_IPv6_BLOCK (Sn_MR_MIP6B)
128#define SF_UNI_BLOCK (Sn_MR_UCASTB)
133#define SF_TCP_ALIGN 0x02
136#define SF_IO_NONBLOCK 0x01
141#define PACK_FIRST 0x80
142#define PACK_REMAINED 0x01
143#define PACK_COMPLETED 0x00
145#define PACK_FIFOBYTE 0x02
165int8_t
socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag);
177int8_t
close(uint8_t sn);
213int8_t
connect(uint8_t sn, uint8_t* addr, uint16_t port);
250int32_t
send(uint8_t sn, uint8_t* buf, uint16_t len);
272int32_t
recv(uint8_t sn, uint8_t* buf, uint16_t len);
300int32_t
sendto(uint8_t sn, uint8_t* buf, uint16_t len, uint8_t* addr, uint16_t port);
330int32_t
recvfrom(uint8_t sn, uint8_t* buf, uint16_t len, uint8_t* addr, uint16_t* port);
335#define SOCK_IO_BLOCK 0
336#define SOCK_IO_NONBLOCK 1
388#if !((_WIZCHIP_ == 5100) || (_WIZCHIP_ == 5200))
sockopt_type
The type of socket option in setsockopt() or getsockopt()
Definition socket.h:379
ctlsock_type
The type of ctlsocket().
Definition socket.h:362
sockint_kind
The kind of Socket Interrupt.
Definition socket.h:347
@ SO_SENDBUF
Valid only in getsockopt. Get the free data size of Socekt TX buffer. Sn_TX_FSR, getSn_TX_FSR()
Definition socket.h:392
@ SO_KEEPALIVESEND
Valid only in setsockopt. Manually send keep-alive packet in TCP mode, Not supported in W5100.
Definition socket.h:387
@ SO_DESTPORT
Set the destination Port number. Sn_DPORT ( setSn_DPORT(), getSn_DPORT() )
Definition socket.h:385
@ SO_STATUS
Valid only in getsockopt. Get the socket status. Sn_SR, getSn_SR()
Definition socket.h:394
@ SO_TTL
Set TTL. Sn_TTL ( setSn_TTL(), getSn_TTL() )
Definition socket.h:381
@ SO_KEEPALIVEAUTO
Set/Get keep-alive auto transmission timer in TCP mode, Not supported in W5100, W5200.
Definition socket.h:389
@ SO_RECVBUF
Valid only in getsockopt. Get the received data size in socket RX buffer. Sn_RX_RSR,...
Definition socket.h:393
@ SO_REMAINSIZE
Valid only in getsockopt. Get the remained packet size in other then TCP mode.
Definition socket.h:395
@ SO_MSS
Set MSS. Sn_MSSR ( setSn_MSSR(), getSn_MSSR() )
Definition socket.h:383
@ SO_DESTIP
Set the destination IP address. Sn_DIPR ( setSn_DIPR(), getSn_DIPR() )
Definition socket.h:384
@ SO_PACKINFO
Valid only in getsockopt. Get the packet information as PACK_FIRST, PACK_REMAINED,...
Definition socket.h:396
@ SO_FLAG
Valid only in getsockopt(), For set flag of socket refer to flag in socket().
Definition socket.h:380
@ SO_TOS
Set TOS. Sn_TOS ( setSn_TOS(), getSn_TOS() )
Definition socket.h:382
@ CS_SET_INTMASK
set the interrupt mask of socket with sockint_kind, Not supported in W5100
Definition socket.h:370
@ CS_GET_INTERRUPT
get the socket interrupt. refer to sockint_kind
Definition socket.h:368
@ CS_GET_MAXTXBUF
get the size of socket buffer allocated in TX memory
Definition socket.h:365
@ CS_SET_IOMODE
set socket IO mode with SOCK_IO_BLOCK or SOCK_IO_NONBLOCK
Definition socket.h:363
@ CS_GET_MAXRXBUF
get the size of socket buffer allocated in RX memory
Definition socket.h:366
@ CS_GET_INTMASK
get the masked interrupt of socket. refer to sockint_kind, Not supported in W5100
Definition socket.h:371
@ CS_CLR_INTERRUPT
clear the interrupt of socket with sockint_kind
Definition socket.h:367
@ CS_GET_IOMODE
get socket IO mode
Definition socket.h:364
@ SIK_RECEIVED
data received
Definition socket.h:350
@ SIK_SENT
send ok
Definition socket.h:352
@ SIK_CONNECTED
connected
Definition socket.h:348
@ SIK_DISCONNECTED
disconnected
Definition socket.h:349
@ SIK_TIMEOUT
timeout occurred
Definition socket.h:351
@ SIK_ALL
all interrupt
Definition socket.h:355
int8_t setsockopt(uint8_t sn, sockopt_type sotype, void *arg)
set socket options
Definition socket.c:830
int8_t disconnect(uint8_t sn)
Try to disconnect a connection socket.
Definition socket.c:309
int32_t sendto(uint8_t sn, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t port)
Sends datagram to the peer with destination IP address and port number passed as parameter.
Definition socket.c:495
int32_t recv(uint8_t sn, uint8_t *buf, uint16_t len)
Receive data from the connected peer.
Definition socket.c:393
int8_t listen(uint8_t sn)
Listen to a connection request from a client.
Definition socket.c:255
int8_t getsockopt(uint8_t sn, sockopt_type sotype, void *arg)
get socket options
Definition socket.c:880
int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag)
Open a socket.
Definition socket.c:115
int32_t send(uint8_t sn, uint8_t *buf, uint16_t len)
Send data to the connected peer in TCP socket.
Definition socket.c:328
int8_t ctlsocket(uint8_t sn, ctlsock_type cstype, void *arg)
Control socket.
Definition socket.c:781
int32_t recvfrom(uint8_t sn, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t *port)
Receive datagram of UDP or MACRAW.
Definition socket.c:600
int8_t connect(uint8_t sn, uint8_t *addr, uint16_t port)
Try to connect a server.
Definition socket.c:269
int8_t close(uint8_t sn)
Close a socket.
Definition socket.c:210
WIZCHIP Config Header File.