how to run tcp/ip sample program

I am working on RCM4000 and wants to communicate with the kit over ethernet port. I have tried with some samle programs :- active .c and serialexa.c but I am not able to establish the connection with the socket. I am continuously sending data at the ethernet port of RCM4000 using PC.
The program remains in below loop:-
while(!sock_established(&socket) && sock_bytesready(&socket)==-1) {

How can I establish the coonnection with the socket?
Please help me…