UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer classic037
Observer
8,979 Views
Registered: ‎03-09-2016

vdma frame data seding to tcp socker write() API

Hi all

 

I can read to vdma data

and I want vdma data send to PC(windows)

 

unsigned char* fb1VirtualAddress;

 

fb1VirtualAddress= vdma_read();

server_socket = socket( PF_INET, SOCK_STREAM, 0);
if(server_socket == -1)
{ printf( "server socket err \n");
exit( 1);
}
memset( &server_addr, 0, sizeof( server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(4000);
server_addr.sin_addr.s_addr= htonl(INADDR_ANY);
if(bind( server_socket, (struct sockaddr*)&server_addr, sizeof( server_addr) ) == -1 )
{
printf( "bind() ERR\n");
exit( 1);
}

if(listen(server_socket, 5) == -1)
{ printf( "wating fail\n");
exit( 1);
}

while( 1)
{
printf( "############ Socket TEST ##########\n");

memset(buff_rcv, 0x00, BUFF_SIZE);

client_addr_size = sizeof( client_addr);
client_socket = accept( server_socket, (struct sockaddr*)&client_addr, &client_addr_size);

 

if(write( client_socket, handle.fb1VirtualAddress, strlen(handle.fb1VirtualAddress)) <= 0)
{
printf( "Write Fail\n");
continue;

}

 

but In the PC does not receive properly.

 

PC(Window code)

 

char* hostpImageBuffer;

hostpImageBuffer = (char *)malloc(sizeof(char)*1280*720*16);

nReturn = recv(host, hostpImageBuffer,strlen(hostpImageBuffer),0);

if (nReturn == 0 || nReturn == SOCKET_ERROR) {
printf("recv failed. Error No. %d\n", WSAGetLastError());
} else if (nReturn != strlen(hostpImageBuffer)) {
printf("Invalid data. Error No. %d\n", WSAGetLastError());
} else {
printf("read success.\n");
printf("RECV ##### : %s\n", hostpImageBuffer);

}

 

Where is wrong? Sender and receiver?
Advice please.

 

0 Kudos
1 Reply
Highlighted
Visitor gy343279479
Visitor
8,848 Views
Registered: ‎07-26-2015

Re: vdma frame data seding to tcp socker write() API

hi~
what result after running your program
0 Kudos