Project Description

This project introduces a self-written library that implements POSIX sockets, also called Berkeley sockets, for ST Nucleo + Ethernet Shield Setup. So far, it allows for TCP client/server connections and UDP client/server communication using WIZnet W5100 chip resources. The interface is taken from POSIX.1-2008 standard that can be compiled and run on both Nucleo board and Linux PC without changing a line of code.

Nucleo board wired with Ethernet shield.

 

Parts:  Nucleo board, Ethernet Shield

More detailed information on the library functionalities are written below:

  • Generic socket management: socket() and close() for socket creation and destruction
  • Generic socket communication: send()/sendto()/write() to transmit andrecv()/recvfrom()/read() to receive using TCP and UDP sockets.
  • TCP client functions: connect() to initiate a connection with a server.
  • TCP server functions: bind()/listen()/accept() to manage server-side connections on a chosen port.
  • UDP client functions: connect() and recvfrom()/sendto() for connectionless communication.
  • UDP server: bind() and recvfrom()/sendto() for connectionless communication.
  • Miscellaneous: stdin, stdout and stderr are directed to the serial port seamlessly.

4 connections at the same time can be made with W5100 because of its internal resources.
The next POSIX functionalities are non-blocking option and select()/poll()functions.

Source : https://balau82.wordpress.com/2015/11/22/update-on-posix-socket-library-for-w5100-client-and-server-for-tcp-or-udp/