This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multiple-client connections on TCP/IP Server

I'm using TCP/IP stack from RL-ARM Library 2.22a and starting point of my project was a sample from Keil LEDSwitch Server.

What i would like to know is what i need to do to be able to receive more then one connection. As currently that is all that i was able to establish.

Here is a debug info that i got when i tried to connect to my HW with second client:

ETH: *** Processing Ethernet frame ***
ETH:  Dest.MAC: 1E:30:6C:A2:45:5E
ETH:  Src. MAC: 00:02:B3:CE:32:23
ETH:  Frame len: 62 bytes
ETH:  Protocol:  0800
IP : *** Processing IP frame ***
IP :  Dest.IP: 192.168.1.90
IP :  Src. IP: 192.168.1.12
IP :  Frame len: 48 bytes
IP :  Protocol:  06, Id: AC36
IP :  Frame valid, IP version 4 OK
ARP:  Adding Cache Entry: 192.168.1.12
ARP:  Existing Cache Entry 0 refreshed
TCP: *** Processing TCP frame ***
TCP:  Src. Port: 1544
TCP:  Dest.Port: 1001
TCP:  Seq.Nr: 824812682
TCP:  Ack.Nr: 0
TCP:  Flags : SYN
TCP:  Allocated Socket 1, port 1001
TCP:  Socket 1, State LISTEN...
TCP ERR: Application rejected Connection request
TCP: Socket 5, Sending Reset
MEM: Allocating 72 bytes
MEM: Allocated 1 blocks from IRQ
MEM:  Used 148 bytes in 2 blocks
TCP:  Src. Port: 1001
TCP:  Dest.Port: 1544
TCP:  Seq.Nr: 0
TCP:  Ack.Nr: 824812683
TCP:  Flags : RST,ACK
IP : Sending IP frame...
IP :  Dest.IP: 192.168.1.12
IP :  Src. IP: 192.168.1.90
IP :  Frame len: 40 bytes
IP :  Protocol:  06, Id: 0002
ETH: Sending Ethernet frame...
ARP:  MAC address resolved from Cache Entry 0
ETH:  Dest.MAC: 00:02:B3:CE:32:23
ETH:  Src. MAC: 1E:30:6C:A2:45:5E
ETH:  Frame len: 54 bytes
ETH:  Protocol:  0800
MEM: Releasing 72 bytes
MEM:  Used 76 bytes in 1 blocks
MEM: Releasing 76 bytes
MEM:  Used 0 bytes in 0 blocks

I setup 5 TCP Sockets in Net_Config.c

What i tried to create two sockets listening to same port, with same or different callback function. Result was the same.

/* Initialize TCP Socket and start listening */
  socket_tcp = tcp_get_socket (TCP_TYPE_SERVER, 0, 60, tcp_callback);
  if (socket_tcp != 0) {
    tcp_listen (socket_tcp, LISTEN_TCP_PORT_NUM);
  }

/* Initialize TCP Socket and start listening */
  socket_tcp1 = tcp_get_socket (TCP_TYPE_SERVER, 0, 60, tcp_callback);
  if (socket_tcp1 != 0) {
    tcp_listen (socket_tcp1, LISTEN_TCP_PORT_NUM);
  }

I looked at the HTTP sample, where more clients can connect, but i guess all that is done inside the library as all you have access to is Number of HTTP Sessions.