Click here to Skip to main content
15,900,906 members
Home / Discussions / C#
   

C#

 
GeneralCollection Pin
Rassul Yunussov29-Jun-05 19:13
Rassul Yunussov29-Jun-05 19:13 
GeneralRe: Collection Pin
Christian Graus29-Jun-05 19:23
protectorChristian Graus29-Jun-05 19:23 
GeneralOleDbTransaction (rollback) Pin
myNameIsRon29-Jun-05 19:12
myNameIsRon29-Jun-05 19:12 
GeneralTrouble with marshalling structure Pin
Josh Lindenmuth29-Jun-05 18:42
Josh Lindenmuth29-Jun-05 18:42 
GeneralRe: Trouble with marshalling structure Pin
Bojan Rajkovic30-Jun-05 15:50
Bojan Rajkovic30-Jun-05 15:50 
Generalfunction template Pin
BicycleTheif29-Jun-05 17:55
BicycleTheif29-Jun-05 17:55 
GeneralRe: function template Pin
Christian Graus29-Jun-05 18:12
protectorChristian Graus29-Jun-05 18:12 
GeneralI have trouble with fgets function in C code Pin
dinh van hai29-Jun-05 17:20
dinh van hai29-Jun-05 17:20 
GeneralRe: I have trouble with fgets function in C code Pin
Christian Graus29-Jun-05 18:14
protectorChristian Graus29-Jun-05 18:14 
GeneralRun another console application in my console application Pin
eggie529-Jun-05 13:08
eggie529-Jun-05 13:08 
GeneralRe: Run another console application in my console application Pin
Matt Gerrans29-Jun-05 14:37
Matt Gerrans29-Jun-05 14:37 
GeneralRe: Run another console application in my console application Pin
eggie530-Jun-05 6:51
eggie530-Jun-05 6:51 
GeneralRe: Run another console application in my console application Pin
leppie30-Jun-05 7:45
leppie30-Jun-05 7:45 
GeneralRe: Run another console application in my console application Pin
Matt Gerrans30-Jun-05 7:55
Matt Gerrans30-Jun-05 7:55 
GeneralFullRowSelect in DataGrid Pin
Jassim Rahma29-Jun-05 11:52
Jassim Rahma29-Jun-05 11:52 
GeneralRe: FullRowSelect in DataGrid Pin
Hugo Migneron30-Jun-05 3:09
Hugo Migneron30-Jun-05 3:09 
GeneralHeader information in UDP Packet Pin
Hugo Migneron29-Jun-05 9:36
Hugo Migneron29-Jun-05 9:36 
Hello,
I am using UDP protocol to broadcast a packet on the network. After I send this packet, some devices on the network answer with a UDP datagram packet containing some information.

My problem is that whenever one of these devices answer, (I know I get the packet because the Socket.Receive function returns me the data I am waiting for) I don't know who this packet is coming from. I am looking for a way to know the IP Address of the packet sender.

This is my code :

<br />
IPEndPoint Broadcast = new IPEndPoint(IP, 2000);<br />
EndPoint BroadcastEP = (EndPoint)Broadcast;<br />
<br />
socket = new Socket(System.Net.Sockets.AddressFamily.InterNetwork,<br />
	SocketType.Dgram, ProtocolType.Udp);<br />
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);<br />
//msg is a byte[] that contains the data<br />
socket.SendTo(msg, 0, msg.Length, SocketFlags.None, BroadcastEP);<br />


Then, if I use the socket.Receive function, I get the payload of the packet but not the header information. Is there a way to get this information (Source's IP Address) with System.Net.Sockets or with System.Net.Sockets.UpdClient ?
I thought I could get this information by using socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.PacketInformation, ... but I just can't seem to figure out how to use it correctly.

If anyone knows how to do this, it would be greatly appreciated!


Hugo Migneron
Generalrunning g++ using process.start Pin
thepersonof29-Jun-05 8:31
thepersonof29-Jun-05 8:31 
GeneralRe: running g++ using process.start Pin
Judah Gabriel Himango29-Jun-05 8:44
sponsorJudah Gabriel Himango29-Jun-05 8:44 
GeneralRe: running g++ using process.start Pin
S. Senthil Kumar29-Jun-05 9:02
S. Senthil Kumar29-Jun-05 9:02 
GeneralRe: running g++ using process.start Pin
S. Senthil Kumar29-Jun-05 9:01
S. Senthil Kumar29-Jun-05 9:01 
GeneralRe: running g++ using process.start Pin
thepersonof29-Jun-05 9:54
thepersonof29-Jun-05 9:54 
GeneralRe: running g++ using process.start Pin
S. Senthil Kumar29-Jun-05 11:45
S. Senthil Kumar29-Jun-05 11:45 
GeneralRe: running g++ using process.start Pin
Matt Gerrans29-Jun-05 14:41
Matt Gerrans29-Jun-05 14:41 
GeneralRe: running g++ using process.start Pin
Matt Gerrans29-Jun-05 14:42
Matt Gerrans29-Jun-05 14:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.