내 첫 게시물뿐만 아니라 내 첫 질문. 저는 현재 UDP 기반의 Artnet protokoll을 가지고 놀고 있습니다. Artnet 데이터를 읽는 Cocoa 응용 프로그램을 개발하려고합니다. 나는 내 대리자 호출되는코코아 AsyncUDPSocket 프레임 워크, (긴) 태그 변수 설명 및 내 대표자는 때로는
nc -u localhost 6454
사용하여 내 청취 포트에 패킷을 보내려고 그럼 언제 있습니다 .. AsyncUDPSocket 코코아 프레임 워크를 사용하기로 결정하고 어떻게 든 작업을 얻었다. 내가 다른 Artnet 응용 프로그램과 함께이 작업을 시도해도 내 대리자는 다시 호출되지 않지만 패킷 분석기에서 패킷을 볼 수 있습니다 ..
"태그"로 인해 발생한 것으로 의심됩니다. 누군가가이 값에 대한 문서를 찾을 수 없어서 (긴) 태그 변수를 설명 할 수 있습니까? 그물에 대한 답변을 찾을 수 없습니다. 내가 현재 작업 가려고
listenSocket_unicast = [[AsyncUdpSocket alloc] initWithDelegate:self]; // This one is not added to the Autorelease pool, so cocoa doesnt delete my socket object.
listenSocket_broadcast = [[AsyncUdpSocket alloc] initWithDelegate:self]; // This one is not added to the Autorelease pool, so cocoa doesnt delete my socket object.
// Bind unicast socket..if adress is not the loopback device
if (![SocketAddress isEqualToString:@LOOPBACK])
if ([listenSocket_unicast bindToAddress:SocketAddress port:ARTNET_PORT error:nil] == NO)
{
NSLog (@"Could not bind unicast socket on Adress %@ and port %i",SocketAddress, ARTNET_PORT);
return NO;
}
else NSLog (@"Unicast Socket bind to on Adress %@ and port %i",SocketAddress, ARTNET_PORT);
// Bind broadcast socket..
if ([listenSocket_broadcast bindToAddress:SocketBroadcastAdress port:ARTNET_PORT error:nil] == NO)
{
NSLog (@"Could not bind broadcast socket on Adress %@ and port %i",SocketBroadcastAdress, ARTNET_PORT);
return NO;
}
else
NSLog (@"Broadcast Socket bind to on Adress %@ and port %i",SocketBroadcastAdress, ARTNET_PORT);
[listenSocket_unicast receiveWithTimeout:-1 tag:0];
[listenSocket_broadcast receiveWithTimeout:-1 tag:0];
[listenSocket_broadcast enableBroadcast:YES error:nil];
및 코드 : 또한 내가 아래
내 초기화 소켓에 대한 코드입니다 ... 내가 코코아 어쩌면 듭니다 아주 기본적인 오류 때문에 개발에 비교적 새로운 오전 추가 할 수 있습니다 : 사전에-(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
[sock receiveWithTimeout:-1 tag:0];
NSLog (@"UDP Delegate executed");
return YES;
}
감사합니다,
마티아스
잘 태그 변수에 대해 알아 냈어, 다른 읽기 요청을 결정하는 데 사용됩니다.하지만 여전히 내 대리인이 작동하지 않습니다. ( – madsonic
어쨌든 지금 내 대리인이 전화를 받으면서 아트넷 실험 .. – madsonic