TCP listen

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
enel_2129601
Level 3
Level 3
10 likes given 5 likes given First like received

Hello,

i want to ask you a question about wiced_tcp_listen(socket,port). i have created two socket for my application. However, by using wiced_tcp_listen function i want to listen two socket with same port. When i start to compile i have encountered error. if i change port number. There is no error. Do you have any suggestion related with this issue.

Best Wishes

0 Likes
4 Replies
Anonymous
Not applicable

Sorry it is not clear what you are trying to do. What is the compile error you have?


Either way it is not possible to have to sockets or apps listening to the same port. In TCP/IP or in general in the protocol stack only one listener may bind to one socket per protocol 

0 Likes

Yes, you understand correctly that is what i want to ask

So in my application i am listening only one port also i open and a socket for each application. For example 1333. port is my main port that listens all device on 1333 port. i also assign port and socket for each device without disconnecting. assume i have 3 device, i open 1334,1335,1336 ports for devices. This ports are always open and i only send data from ports. i am looking for a way such that opening only one port for all devices not the number of devices.

Thanks

0 Likes
Anonymous
Not applicable

So what you want to do is the listen on only one port as a server

The devices will make connections to this port as clients and the connection would have the same server port but different client port to have a unique 5-tuple

0 Likes

engin.875 wrote:

Yes, you understand correctly that is what i want to ask

So in my application i am listening only one port also i open and a socket for each application. For example 1333. port is my main port that listens all device on 1333 port. i also assign port and socket for each device without disconnecting. assume i have 3 device, i open 1334,1335,1336 ports for devices. This ports are always open and i only send data from ports. i am looking for a way such that opening only one port for all devices not the number of devices.

Thanks

I think wiced_tcp_server_start() is the API you are looking for.

You can reference the http_server.c to use this API.