LInux PC to FPGA communication


I wrote a TCP IP client using stream socket and tried to communicate that with FPGA server. But the communication is not happening. At the same time from windows TCP/Ip client(written in C#)can communicate the FPGA board.

Please let me know if it is possible the Linux to FPGA communication using stream socket. I used AF_INET family to communicate the FPGA server.

Thanks and Regards,
windows and linux use the same protocol (tcp/ip), so if win connected means fpga server is working correctly.

You linux client is simply written bad ;P do it again or use exciting one.
Show your client code.
#include "Hmi_Lan_Interface.h"

void* Transmit_Data(void *DataParam)
LAN_MSG *tx;
int fd,rc,i;

tx = malloc(sizeof(LAN_MSG));

tx = (LAN_MSG *)DataParam;
tx->Length = 6;

printf("Length of the data = %d\n", tx->Length);
for(i=0;i<tx->Length;i++) printf("%.2x \t", (unsigned int )tx->buf[i]);

if(send (tx->sock_fd, (char *)tx->buf,sizeof(LAN_MSG),0) == -1)
printf("Send error");
printf("\n Message has been transmitted to RCN\n");
// Close_Socket(tx);

void* Recieve_Data(void *DataParam)
rx = (LAN_MSG *)DataParam;

printf("Sockfd %d\n",rx->sock_fd);

if(recv(rx->sock_fd,rx->buf,200, 0) == -1)
printf("recieve error");

int Close_Socket(LAN_MSG *TX)
if(close(TX->sock_fd) == -1)
// printf("\nCould not close socket\n");
return 0;

int Create_Socket()
struct hostent* pHostInfo; /* holds info about a machine */
struct sockaddr_in Address; /* Internet socket address stuct */
int socket_fd;
long nHostAddress;
char strHostName[200];
int nHostPort;

printf("\nMaking a socket");
/* make a socket */

if( socket_fd== -1)
printf("\nCould not make a socket\n");
return 0;

/* get IP address from name */
/* copy address into long */

/* fill address struct */

printf("\nConnecting to %s on port %d",strHostName,nHostPort);

/* connect to host */
if(connect(socket_fd,(struct sockaddr*)&Address,sizeof(Address)) == -1)
printf("\nCould not connect to host\n");
return 0;

return socket_fd;


This is my client communication layer. In this connect itself is failing. I am not understanding why connection itself is not establishing???
Topic archived. No new replies allowed.