Using AGSocket for UDP networking
Using AGSocket for UDP networking
- Subject: Using AGSocket for UDP networking
- From: Rustam Muginov <email@hidden>
- Date: Tue, 26 Jul 2005 17:22:09 +0400
Hello all.
I am trying to use AGSocket in Cocoa project to send and receive UDP
packets.
Sending works ok, but for receiving I am using the folowing code:
AGInetSocketAddress *addr = [AGInetSocketAddress addressWithHostname:
@"127.0.0.1" port: 1001];
socket = [[AGSocket udpSocket] retain];
[socket setDelegate: self];
BOOL b;
b = [socket listenOnAddress: addr];
// Here is the problem
NSLog( @"listen on addr = %d, error %d, \"%s\"", b, [socket error],
strerror( [socket error] ) );
while( true )
{
NSData *data = [socket readDataOfLength: 128];
NSLog( @"data read %d str %@", [data length], [[[NSString alloc]
initWithData:data encoding: NSUTF8StringEncoding ] autorelease] );
}
If I am running this code, I am getting the following error after the
calling to the "listenOnAddress:" method I am getting " error 13,
"Permission denied" error.
This error is the same then I am working with my ADSL dinamyc adress.
If I am manualy launching application binary via terminal with "sudo"
command, it works ok.
In the office, at the local network, where IP is 172.16.0.2, I am getting
other error " error 49, "Can't assign requested address"
Does this need using AGSocket requires admin privileges?
Thank you.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden