- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I modified the DE_WEB project ,and made a simple socket client to connect to the server on PC.
The server on PC is developed on Visual C++,and it works well(can be connected by client on PC). But the client in this project on DE2 could not connect to the server,the function connect() returns errtimeout. but I can get reply from the DE2 board using ping command. what's wrong? here are some of code in client: static char* ip="192.168.0.139"; static int port=104; static SOCKET socketfd; static struct sockaddr_in local; void clienttask() { int flag; socketfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if(socketfd == INVALID_SOCKET) { die_with_err("socket create fail"); } local.sin_family = AF_INET; local.sin_port = htons(port); local.sin_addr.s_addr = inet_addr(ip); flag = connect(socketfd, (struct sockaddr*)&local, sizeof(local)); if(flag == SOCKET_ERROR) { die_with_err("connect err"); } }Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I check the errno,and find I/O Error
who can tell me how to fix the problem?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page