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

TCP Server is not working!

Dear Friends,
I am trying to create a simple TCP server using STM32F107RCt6 microcontroller and DP83848C PHY. I use CMSIS RTXv4 and Keil uVision5 pro and Keil Network component version 7.7.0.
In RTX_Conf_CM.c configuration wizard, I've done the following configuration:
Default Thread Stack size: 512
Main Thread Stack size: 800
Number of Threads with user-provided stack size: 2(netETH_Thread and netCore_Thread)
Total stack size for user-provided stack size: 1536(512+1024)
and user timers are enable.
The Stack size and Heap size are respectively 1024 and 512 bytes.
In RTE.h file I've enabled Ethernet RMII mode. The AHB clock and system clock are 72MHz.
I've added the TCP_Socket_Server.c template file and uncomment lines 18 and 42 and delete IPv6 code and change the client IP address to my computer IP.
The code is as follows:


#include "rl_net.h"

// Notify the user application about TCP socket events.
uint32_t tcp_cb_server (int32_t socket, netTCP_Event event,
                        const NET_ADDR *addr, const uint8_t *buf, uint32_t len) {

  switch (event) {
    case netTCP_EventConnect:
      // Connect request received
      if (addr->addr_type == NET_ADDR_IP4) {
        // IPv4 client
        if (addr->addr[0] == 192  &&
            addr->addr[1] == 168  &&
            addr->addr[2] == 0    &&
            addr->addr[3] == 101) {
          // Accept connection from client at 192.168.0.101
          return (1);
        }
      }
      // Deny connection.
      return (0);
    case netTCP_EventEstablished:
      // Connection established
      break;

    case netTCP_EventClosed:
      // Connection was properly closed
      break;

    case netTCP_EventAborted:
      // Connection is for some reason aborted
      break;

    case netTCP_EventACK:
      // Previously sent data acknowledged
      break;

    case netTCP_EventData:
      // Data received
      /* Example
      if ((buf[0] == 0x01) && (len == 2)) {
        // Switch LEDs on and off
        // LED_out (buf[1]);
      }
      */
      break;
  }
  return (0);
}

// Allocate and initialize the socket.
int main (void) {
  int32_t tcp_sock;
  netInitialize ();
  // Initialize TCP Socket and start listening on port 2000
  tcp_sock = netTCP_GetSocket (tcp_cb_server);
  if (tcp_sock > 0) {
    netTCP_Listen (tcp_sock, 2000);
  }
}
//! [code_TCP_Socket_Server]


Unfortunately, the code is not working and I have no idea how to solve it.
Any helps would be greatly appreciated.