FreeRTOS / FreeRTOS-Plus-TCP

FreeRTOS-Plus-TCP library repository. +TCP files only. Submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
MIT License
151 stars 162 forks source link

[Feature Request] <add BSD sockets interface> #1070

Closed bigtreeboy closed 10 months ago

bigtreeboy commented 10 months ago

I have had a BSD sockets based application. Now I want to change the TCP/IP stack to freeRTOS-Plus-TCP. but, unfortunately, freeRTOS-Plus-TCP doesn't supply the BSD sockets interface directly. If freeRTOS-Plus-TCP has the BSD sockets interface, I don't need change anything in the application.

tony-josi-aws commented 10 months ago

Hi @bigtreeboy,

FreeRTOS+TCP supports BSD style sockets and APIs. Refer: Primary Sockets Functions

Suggest you to post these queries in the FreeRTOS Forum.

bigtreeboy commented 10 months ago

Hi @tony-josi-aws, thanks for your answer. But, was there these header file in current freeRTOS-Plus-TCP repo? according to Berkeley sockets, the standard headers are sockets.h netdb.h and so on. Because I have had a unix based application, I want to reuse this code without changing anything.

htibosch commented 10 months ago

PS. please close this subject and continue on the FreeRTOS forum.

What you can do is create a new set of sockets.h, netdb.h etc, and from there you can include the FreeRTOS includes.

Also, you can introduce these kind of macros:

#define socket    FreeRTOS_socket
#define bind      FreeRTOS_bind
#define listen    FreeRTOS_listen
#define connect   FreeRTOS_connect
#define accept    FreeRTOS_accept
#define recvfrom  FreeRTOS_recvfrom
#define sendto    FreeRTOS_sendto
#define recv      FreeRTOS_recv
#define send      FreeRTOS_send

You will have to study the Linux application and check if the FreeRTOS functions do exactly the same. And at some point, you will need an intermediate function when the use of parameters is slightly different, such as select().

bigtreeboy commented 10 months ago

If there is a official version for BSD sockets interface, I think it's better. of cause, I can implement it by myself. I will close this feature request.