I was playing around with the following code to try and get my RMC3200 to connect to a socket on a remote Linux computer on our network.
The return value for tcp_open is always 1 which I assume means it can locate my remote computer but sock_established never returns a 1 or establishes. Anyone have any suggestions for me?
void main()
{
char buffer[100];
int bytes_read;
int rtn;
longword destIP;
tcp_Socket socket;
printf( "initializing..
" );
sock_init();
ifconfig (IF_ETH0, IFS_DOWN, IFS_END) ;
// Wait for the interface to come up
while (ifpending(IF_DEFAULT) == IF_COMING_UP) {
tcp_tick(NULL);
}
if( 0L == (destIP = resolve(DEST)) ) {
printf( "ERROR: Cannot resolve \"%s\" into an IP address
", DEST );
exit(2);
}
rtn = ifconfig(IF_ETH0,
IFS_DOWN,
IFS_IPADDR, aton(“192.168.0.150”),
IFS_NETMASK, aton(“255.255.255.0”),
IFS_UP,
IFS_END);
printf(" ifconfig RTN: %d
",rtn);
rtn = tcp_open(&socket,0,destIP,PORT,NULL);
sock_perror(&socket," SOCKET ERROR: ");
printf("tcp_open rtn: %d
",rtn);
printf("Waiting for connection...
");
while(!sock_established(&socket)){
tcp_tick(NULL);
}
printf("Connection established, sending get request...
");