We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi there. This thread is related to the RL-TCPnet component using the MCB4300 board.
I'm trying to connect a socket using the tcp_connect function to an external server.
I can connect the socket to internal servers (by internal I mean running in the same network), but when it comes to external servers it just aborts the connection. In other words, the callback function to the tcp_connect function just gets the TCP_EVT_ABORT as an event.
Here's a snippet of the code I'm using:
U8 tcp_soc; U16 tcp_callback (U8 soc, U8 event, U8 *ptr, U16 par) { switch (event) { case TCP_EVT_CONREQ: // This event just comes up on internal connections return (1); case TCP_EVT_ABORT: // When trying to connect to external servers, I just get the connection ABORTED break; case TCP_EVT_CONNECT: break; case TCP_EVT_CLOSE: break; case TCP_EVT_ACK: break; case TCP_EVT_DATA: break; } return (0); } void main (void) { init (); init_TcpNet (); tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT|TCP_TYPE_KEEP_ALIVE , 0 , 10000 , tcpCallback); while (1) main_TcpNet (); }
Does anyone have any clue about what is going on?
I forgot to say some things about my own topic:
1. The server I'm trying to connect DOES HAVE a public IP address.
2. I can connect to this server by using the traditional connect() C function in a desktop computer.
Do you have a default gateway?
Without a gateway (such as the office firewall) to route the communication to, you will not be able to access anything that isn't on the local network.
The problem was the proxy. It was solved already. Thank you.