This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: tcp client code

Part Number: TM4C1294NCPDT

I have created a TCP client based on TCP echo example for TN4C1294NCPDT,but server connection failed 

client code-

Void tcpHandler(UArg arg0, UArg arg1)
{
int sockfd;
struct sockaddr_in servaddr;

while(1)
{

// socket create and varification
sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sockfd == -1) {
printf("socket creation failed...\n");
exit(0);
}
else
printf("Socket successfully created..\n");


memset(&servaddr, 0, sizeof(servaddr));
// assign IP, PORT
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = inet_addr("192.168.1.4");
servaddr.sin_port = htons(PORT);

// connect the client socket to server socket
if (connect(sockfd, (SA*)&servaddr, sizeof(servaddr)) != 0){
printf("connection with the server failed...\n");
// exit(0);
}
else
printf("connected to the server..\n");
}