Click here to Skip to main content
15,905,875 members
Home / Discussions / C#
   

C#

 
AnswerRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 0:07
professionalMycroft Holmes22-Feb-11 0:07 
GeneralRe: Preventing MDI child form from losing focus Pin
Wayne Gaylard22-Feb-11 0:44
professionalWayne Gaylard22-Feb-11 0:44 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 0:51
Dewald22-Feb-11 0:51 
GeneralRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 11:00
professionalMycroft Holmes22-Feb-11 11:00 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 19:03
Dewald22-Feb-11 19:03 
GeneralRe: Preventing MDI child form from losing focus Pin
Mycroft Holmes22-Feb-11 19:34
professionalMycroft Holmes22-Feb-11 19:34 
GeneralRe: Preventing MDI child form from losing focus Pin
Dewald22-Feb-11 19:45
Dewald22-Feb-11 19:45 
QuestionGet IP address on a LAN [modified] Pin
Mc_Topaz21-Feb-11 23:14
Mc_Topaz21-Feb-11 23:14 
I have four Lantronix X-Port devices connected to my LAN. All of these devices communicates by port 30718, I want to retrive the devices IP-addresses. I used the UdpClient to send a broadcast on that port to find what ever responded. But I didn't receive any usefull information.

Here is my code:
using System.Net;
using System.Net.Sockets;

IPEndPoint broadCastIp = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 30718);
string dataStr = "\0\0\0" + ((char)246).ToString();

private void BroadCast()
{
    UdpClient udp = new UdpClient();
    byte[] data = new UTF8Encoding().GetBytes(dataStr);
    List<byte[]> bytes = new List<byte[]>();

    udp.Send(data, data.Length, broadCastIp);
    System.Threading.Thread.Sleep(481);

    while (udp.Available > 0)
        bytes.Add(udp.Receive(ref broadCastIp));

    udp.Close();
}

This receives the MAC address from one of the devices and some other unknown data.

Actually I have no idéa how to receive each device's IP-address. Just for fun I installed WireShark to see what happened when I run the BroadCast method. In wireshark I got this information:
Source           Destination        Info
192.168.10.182   255.255.255.255    Source port: 55316 Destination port: 30718
192.168.10.165   192.168.10.182     Source port: 30718 Destination port: 55316
192.168.10.91    192.168.10.182     Source port: 30718 Destination port: 55316
192.168.10.61    192.168.10.182     Source port: 30718 Destination port: 55316
192.168.10.62    192.168.10.182     Source port: 30718 Destination port: 55316

This is what I'm looking for. It's the correct for IP-addresses for each devices.

So... is it possible to get those four IP-addresses in C#?

modified on Tuesday, February 22, 2011 5:28 AM

AnswerRe: Get all IP address on a LAN Pin
Rob Philpott21-Feb-11 23:32
Rob Philpott21-Feb-11 23:32 
GeneralRe: Get all IP address on a LAN Pin
Mc_Topaz21-Feb-11 23:43
Mc_Topaz21-Feb-11 23:43 
GeneralRe: Get all IP address on a LAN Pin
Rob Philpott22-Feb-11 1:39
Rob Philpott22-Feb-11 1:39 
AnswerRe: Get IP address on a LAN Pin
OriginalGriff21-Feb-11 23:36
mveOriginalGriff21-Feb-11 23:36 
Questionhandle data in GUI (datagridview) and database Pin
Ronenb21-Feb-11 21:29
Ronenb21-Feb-11 21:29 
AnswerRe: handle data in GUI (datagridview) and database Pin
OriginalGriff21-Feb-11 21:48
mveOriginalGriff21-Feb-11 21:48 
GeneralRe: handle data in GUI (datagridview) and database Pin
Mycroft Holmes22-Feb-11 0:10
professionalMycroft Holmes22-Feb-11 0:10 
GeneralRe: handle data in GUI (datagridview) and database Pin
OriginalGriff22-Feb-11 0:14
mveOriginalGriff22-Feb-11 0:14 
GeneralRe: handle data in GUI (datagridview) and database Pin
Ronenb22-Feb-11 1:28
Ronenb22-Feb-11 1:28 
AnswerRe: handle data in GUI (datagridview) and database Pin
PIEBALDconsult22-Feb-11 1:36
mvePIEBALDconsult22-Feb-11 1:36 
GeneralRe: handle data in GUI (datagridview) and database Pin
Ronenb22-Feb-11 7:51
Ronenb22-Feb-11 7:51 
GeneralRe: handle data in GUI (datagridview) and database Pin
PIEBALDconsult22-Feb-11 13:38
mvePIEBALDconsult22-Feb-11 13:38 
GeneralRe: handle data in GUI (datagridview) and database Pin
Ronenb22-Feb-11 20:17
Ronenb22-Feb-11 20:17 
QuestionRemove duplicates Pin
kulldeep verma21-Feb-11 19:48
kulldeep verma21-Feb-11 19:48 
AnswerRe: Remove duplicates Pin
Sunasara Imdadhusen22-Feb-11 1:19
professionalSunasara Imdadhusen22-Feb-11 1:19 
Questionhow to manage an asymmetric key in key container for an enterprise software ? Pin
hani jizzan21-Feb-11 18:12
hani jizzan21-Feb-11 18:12 
RantImplicit Type Casting Pin
Adriaan Davel21-Feb-11 17:42
Adriaan Davel21-Feb-11 17: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.