장치 사이의 UPnP 수준 통신을 구현하려고하지만 응답 메시지를받는 데 문제가 있습니다 .SSDP를 보내면 더 이상 : 메시지를 수신 할 수없는 검색 멀티 캐스트 장치는 ... 내가 나를 수행UPnP 장치 간의 ssdp 통신을 수행하는 방법
전제 조건이 주제 newto 완전히 생각을 통해서 나를 안내 사항 : M-검색을 보내 .. 그리고 네트워크에 메시지를 통지하는
1.able .. 그리고 wireshark를 통해 확인했습니다.
2.gn upnp 아키텍처 관련 pdf
응답 와이어 샤크에 도착 : 나는 목적지에 도달하지 않은 ICMP 오류 메시지 ..
< 클라이언트 측 코드를 얻고 메시지를 보내고 그 어느 때
>를 첫 번째와 두 번째입니다 되는 시간 동안 난 그냥 M-검색하기 당신의 로컬 호스트에
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#define SRV_IP "127.0.0.1"
/* diep(), #includes and #defines like in the server */
#define BUFLEN 512
#define NPACK 10
#define PORT 1900
void diep(char *s)
{
perror(s);
exit(1);
}
int main(void)
{
struct sockaddr_in si_other;
int s, i, slen=sizeof(si_other);
char buf[BUFLEN];
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
diep("socket");
memset((char *) &si_other, 0, sizeof(si_other));
si_other.sin_family = AF_INET;
si_other.sin_port = htons(PORT);
if (inet_aton(SRV_IP, &si_other.sin_addr)==0) {
fprintf(stderr, "inet_aton() failed\n");
exit(1);
}
for (i=0; i<NPACK; i++) {
printf("Sending packet %d\n", i);
sprintf(buf, "\n");
if (sendto(s, buf, BUFLEN, 0, &si_other, slen)==-1)
diep("sendto()");
}
close(s);
return 0;
}
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#define BUFLEN 512
#define NPACK 10
#define PORT 1900
void diep(char *s)
{
perror(s);
exit(1);
}
int main(void)
{
struct sockaddr_in si_me, si_other;
int s, i, slen=sizeof(si_other);
char buf[BUFLEN];
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
diep("socket");
memset((char *) &si_me, 0, sizeof(si_me));
si_me.sin_family = AF_INET;
si_me.sin_port = htons(PORT);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(s, &si_me, sizeof(si_me))==-1)
diep("bind");
for (i=0; i<NPACK; i++) {
if (recvfrom(s, buf, BUFLEN, 0, &si_other, &slen)==-1)
diep("recvfrom()");
printf("Received packet from %s:%d\nData: %s\n\n",
inet_ntoa(si_other.sin_addr), ntohs(si_other.sin_port), buf);
}
close(s);
return 0;
}
지금까지 작성한 코드를 보여줄 수 있습니까? – simonc
처음에는 "nping --udp -g1900 -p1900 --data-string" "239.255.255.250 –
명령을 사용하여 M 검색 메시지를 보내는 데 nping을 사용했습니다. 같은 C 언어 코드를 사용하여 ... 별도의 서버 및 클라이언트 쪽 .. 코드의 코드를 –