Microsoft MVP성태의 닷넷 이야기
.NET : 35. UDP 패킷의 경유 IP 설정 (Source Routing) [링크 복사], [링크+제목 복사]
조회: 10740
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

How to programmatically inject a list of IP Addresses into the IP Options header in the IP Datagram [ Source Routing ]?
; http://blogs.msdn.com/winsdk/archive/2009/11/05/how-to-programmatically-inject-a-list-of-ip-addresses-into-the-ip-options-header-in-the-ip-datagram-source-routing.aspx

UDP 에 이런 기능이 있는지 몰랐군요. ^^;

IPPROTO_IP, IP_OPTIONS 인자로 setsockopt 를 하는 경우 같이 넘겨준 IP 를 경유해서 최종 목적지로 패킷이 전달되게 됩니다. 읽고 보니, 궁금해지는 데요. 그렇다면 경유하는 IP의 NIC 카드 레벨에서 라우팅을 해주는 것인가요? 오호... 외부망에서 UDP 를 내부망으로 보낼 수 있다는 의미인데... 테스트 한번 해봐야겠군요. ^^

코드가 간단하니 여기에 옮겨 봅니다.

1: \\Define a structure for LSR
2: typedef struct
3: {
4: unsigned char Code;
5: unsigned char Len;
6: unsigned char Offset;
7: unsigned long Addrs[2];
8: }LSR;
9:
10: //Set the Loose Source Routing Option:
11: LSR SourceRoute;
12: ZeroMemory(&SourceRoute,sizeof(LSR));
13:
14: SourceRoute.Code = 0x83; // Loose Source Routing.
15: SourceRoute.Len = 11;
16: SourceRoute.Offset = 4;
17: SourceRoute.Addrs [0] = inet_addr("a.b.c.d");
18: SourceRoute.Addrs [1] = inet_addr("x.y.z.q");
19:
20: //Set the source routing on the socket handle.
21: int iErr = setsockopt(SocketHandle,IPPROTO_IP,IP_OPTIONS,(char*)&SourceRoute,SourceRoute.oLen);








[최초 등록일: ]
[최종 수정일: 11/10/2009]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-동일조건변경허락 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  [8] 
NoWriterDateCnt.TitleFile(s)
18정성태7/17/20034013RegistryEx 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
17정성태9/22/20054874Crypto 클래스 (VC++6.0, Win32) [1]파일 다운로드1
16정성태7/17/20034430Win32 Control Spy (Win32)파일 다운로드1
15정성태7/17/20035112RichEdit Control 클래스 (VC ++ 6.0)파일 다운로드1
1  2  3  4  5  6  7  [8]