tcp_socket.c File Reference
TCP sockect with kfile interface. More...
#include "tcp_socket.h"#include "cfg/cfg_tcpsocket.h"#include <cfg/log.h>#include <cpu/byteorder.h>#include <lwip/ip_addr.h>#include <lwip/api.h>#include <lwip/netif.h>#include <lwip/netbuf.h>#include <lwip/tcpip.h>Go to the source code of this file.
Functions | |
| void | tcpsocket_serverPoll (KFile *fd) |
| Process all received connection from socket. | |
| void | tcpsocket_init (TcpSocket *socket, struct ip_addr *local_addr, struct ip_addr *remote_addr, uint16_t port) |
| Init tcp socket connection with kfile interface. | |
| void | tcpsocket_serverInit (TcpSocket *socket, struct ip_addr *local_addr, struct ip_addr *listen_addr, uint16_t port, tcphandler_t handler) |
| Init tcp server whit kfile interface. | |
Detailed Description
TCP sockect with kfile interface.
Definition in file tcp_socket.c.
Function Documentation
| void tcpsocket_init | ( | TcpSocket * | socket, |
| struct ip_addr * | local_addr, | ||
| struct ip_addr * | remote_addr, | ||
| uint16_t | port | ||
| ) |
Init tcp socket connection with kfile interface.
- Note:
- the real connection will be performed only when we do the first kfile_read(). The read function is blocking and receive timeout is not settable, this depends to the current version of lwip.
- Parameters:
-
socket tcp socket context. local_addr device ip address. remote_addr ip address that we would connect. port tcp port that we would connect.
Definition at line 297 of file tcp_socket.c.
| void tcpsocket_serverInit | ( | TcpSocket * | socket, |
| struct ip_addr * | local_addr, | ||
| struct ip_addr * | listen_addr, | ||
| uint16_t | port, | ||
| tcphandler_t | handler | ||
| ) |
Init tcp server whit kfile interface.
Start a tcp server on registered ethernet interface, and it calls the user handler when receive data from accepted connection socket.
- Note:
- Use the tcpsocket_serverPoll() function to process al connections.
- Parameters:
-
socket tcp socket context. local_addr device ip address. listen_addr ip address to listen port tcp socket port to listen handler user handler that server calls every time we recive a data from socket. To the handler the server will pass the kfile context and user could choose to make an explicit connection close, otherwise the server keep alive the connection.
Definition at line 331 of file tcp_socket.c.
| void tcpsocket_serverPoll | ( | KFile * | fd | ) |
Process all received connection from socket.
- Parameters:
-
fd opened tcp socket server kfile context.
Definition at line 269 of file tcp_socket.c.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)