I need some help with networking information. I've figured out most of the simple stuff and made it simpler still with an application extension, however there are a few things that still confuse me. With sockets it "appears" as though I have the ability to send information such as text from a text box over the internet. I don't understand how to begin implementing this quite yet. I could use some links to get me started.

I understand what a ping does and how it can be used, however I'm having some problems with the Ping class in System.Net.NetworkInformation. I'm trying to get the echo's address but it keeps throwing an exception. Since I don't have my compiler on this computer I can't tell you all what the exception is but I can include the code snippet and comment the section that's throwing it.

byte[] MyBuffer = new byte[1000];
Ping MyPing = new Ping();
PingReply MyReply = MyPing.Send(IPAddress.Broadcast, 5000, MyBuffer);
string ResultString = MyReply.Address.Address.ToString(); // Throws exception everytime.

Buffers I don't understand at all, is this what contains the information that is to be sent or received? If so how and some links with more information. If not then please some links on what the buffer is when it comes to Sockets and Ping.

All help is greatly thanked and I will reply when I can since I rarely have internet anymore. I have to use WiFi hotspots at cafes around the city. Low on funds so most of them give me a hard time nowadays.

What are you trying to do? Normally with a ping its along the lines of "are you there (echo request)?. Yes I am (echo response)."

You normally don't want to populate any sort of buffer with pings (ICMP) unless you have a specific purpose for doing so.

As far as the exception -- i'm guessing its a null reference exception. Jot it down when you test it next.

Yes it was a null reference. The buffer question is more of for usage with sockets. I'm trying to figure out how to send text from a user application to a master application. I've been debugging a few friends computers which easier to do using the tools I have on mine. Problem is I get tired of writing down all my information from their computers and then typing it up in mine. It's an annoying hassle that I want to be rid of. So just sending the text in a rich text box from one computer to another should be very helpful. I have my ping method working fine now. I had a problem retrieving the ScopeId using the PingReply class. I'm not too worried about that problem though, I'll solve it later.

ICMP is more of a control protocol and not typically used for data delivery. Based on your project requirements I would recommend using TCP.

You can use raw sockets to send/receive data but you would be re-inventing the wheel. I would recommend using WCF to send messages between your application.

Here is a great example:
http://www.codeproject.com/KB/WCF/WCFWPFChat.aspx

I'll read over it and let you know how it goes. Thanks for the information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.