Click here to Skip to main content
15,891,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need help with my very first c# application Pin
S Houghtelin7-Oct-10 9:34
professionalS Houghtelin7-Oct-10 9:34 
GeneralRe: Need help with my very first c# application Pin
Luc Pattyn7-Oct-10 9:55
sitebuilderLuc Pattyn7-Oct-10 9:55 
GeneralRe: Need help with my very first c# application Pin
S Houghtelin7-Oct-10 10:01
professionalS Houghtelin7-Oct-10 10:01 
GeneralRe: Need help with my very first c# application Pin
OriginalGriff7-Oct-10 9:20
mveOriginalGriff7-Oct-10 9:20 
GeneralRe: Need help with my very first c# application Pin
turbosupramk37-Oct-10 10:01
turbosupramk37-Oct-10 10:01 
GeneralRe: Need help with my very first c# application Pin
turbosupramk37-Oct-10 10:12
turbosupramk37-Oct-10 10:12 
GeneralRe: Need help with my very first c# application Pin
OriginalGriff7-Oct-10 21:34
mveOriginalGriff7-Oct-10 21:34 
GeneralRe: Need help with my very first c# application Pin
turbosupramk38-Oct-10 4:28
turbosupramk38-Oct-10 4:28 
Thanks and be proud, I touched it up to this, this morning and it actually works!!! Big Grin | :-D

Next on the list is to import a text file through streamreader? or textreader?

Hopefully I can find some more code like this basic ping tool on MSDN or something and then I'll be able to import each server with my foreach loop?


using System;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using System.IO;


namespace Examples.System.Net.NetworkInformation.PingTest
{
    public class PingExample
    {
        // args[0] can be an IPaddress or host name.

      
                  
        public static void Main(string [] args)
        {
            
            Ping pingSender = new Ping();
            PingOptions options = new PingOptions();



            // Use the default Ttl value which is 128,
            // but change the fragmentation behavior.
            options.DontFragment = true;

            // Create a buffer of 32 bytes of data to be transmitted.
            string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            byte[] buffer = Encoding.ASCII.GetBytes(data);
            int timeout = 120;

            string[] arr = new string[] { "server1", "server2", "server3" }; // server names you want to ping

            foreach (string i in arr)

            {
               int pingloop = 0;
               Console.WriteLine(i);

               do
               {

                   PingReply reply = pingSender.Send(i, timeout, buffer, options);
                   if (reply.Status == IPStatus.Success)
                   {
                       Console.WriteLine("Reply from {0}", reply.Address.ToString() + ": bytes=" + reply.Buffer.Length + " time=" + reply.RoundtripTime + "ms" + " TTL=" + reply.Options.Ttl);
                       pingloop = pingloop +1;
                       //Console.WriteLine("Bytes {0}", reply.Buffer.Length);
                       //Console.WriteLine("RoundTrip time: {0}", reply.RoundtripTime);
                       //Console.WriteLine("Time to live: {0}", reply.Options.Ttl);
                       //Console.WriteLine("Don't fragment: {0}", reply.Options.DontFragment);
                       
                   }
               }

               while (pingloop < 4);
               Console.WriteLine();     
               
                
            }
            Console.ReadLine();
        }

    }

GeneralRe: Need help with my very first c# application Pin
OriginalGriff8-Oct-10 4:51
mveOriginalGriff8-Oct-10 4:51 
GeneralRe: Need help with my very first c# application Pin
turbosupramk313-Oct-10 7:20
turbosupramk313-Oct-10 7:20 
GeneralRe: Need help with my very first c# application Pin
S Houghtelin7-Oct-10 9:16
professionalS Houghtelin7-Oct-10 9:16 
AnswerRe: Need help with my very first c# application Pin
Nish Nishant7-Oct-10 8:17
sitebuilderNish Nishant7-Oct-10 8:17 
AnswerRe: Need help with my very first c# application Pin
MasttsaM13-Oct-10 22:43
MasttsaM13-Oct-10 22:43 
QuestionAbout creating Editable(fillable) PDF-forms Pin
sameermaske7-Oct-10 4:04
sameermaske7-Oct-10 4:04 
AnswerRe: About creating Editable(fillable) PDF-forms Pin
Ennis Ray Lynch, Jr.7-Oct-10 6:26
Ennis Ray Lynch, Jr.7-Oct-10 6:26 
QuestionParsing a text file. Pin
jenya77-Oct-10 3:21
jenya77-Oct-10 3:21 
AnswerMessage Closed Pin
7-Oct-10 3:41
stancrm7-Oct-10 3:41 
GeneralRe: Parsing a text file. Pin
jenya77-Oct-10 3:57
jenya77-Oct-10 3:57 
GeneralRe: Parsing a text file. Pin
#realJSOP7-Oct-10 23:41
mve#realJSOP7-Oct-10 23:41 
AnswerRe: Parsing a text file. Pin
PIEBALDconsult7-Oct-10 16:28
mvePIEBALDconsult7-Oct-10 16:28 
QuestionMicrosoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 2:58
Blubbo7-Oct-10 2:58 
AnswerRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Dave Kreskowiak7-Oct-10 3:44
mveDave Kreskowiak7-Oct-10 3:44 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 4:02
Blubbo7-Oct-10 4:02 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Dave Kreskowiak7-Oct-10 4:42
mveDave Kreskowiak7-Oct-10 4:42 
GeneralRe: Microsoft.Office.Interop.Excel BorderAround2 crash Pin
Blubbo7-Oct-10 4:49
Blubbo7-Oct-10 4:49 

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.