|
-
February 27th, 2009, 12:50 AM
#1
UDP connection
hello group,
i'm trying to send a socket over udp. i'm doing it on same machine with loopback address. i wrote a server code n a client code. when i run them both, there should be a connection when i send text from client to server. client window shows sent complete n server window says waiting for connection that means recvfrom() is hanged or blocked. it does not go beyond recvfrom(). i tried connect() also from client. no luck.
my pseudo code is,
//client.c
while(1){
create server socket
create client socket
s = socket(AF_INET, SOCK_DGRAM, 0);
bind() //client socket
sendto(s,buf,10,0,server,sizeof());
}
//server.c
creat server socket
s= socket()
bind(server)
while(1){
"waiting for connection"
recvfrom(s,buf,10,0,client,length);
}
please tell wer am i doing wrong.
n one more,
i have such a code for TCp also. it works fine with loopback addr. two windows on same machine talk to each other. but it does not work with network addr. like if i replace 127.0.0.1 with 192.168.1.85 it gives error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|