TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
529
41.3k
c# thread sleep sending not respond
Apr 20 2021 12:07 PM
I Will Run This Ping App UI Not Working And Not Respond
Here Is Code
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.Net.NetworkInformation;
using
System.Threading;
namespace
WindowsFormsApp1
{
public
partial
class
Form1 : Form
{
public
static
int
check = 0;
static
System.Windows.Forms.Timer myTimer =
new
System.Windows.Forms.Timer();
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
ping();
}
public
void
ping()
{
int
q = Convert.ToInt32(packet1.Text);
check = 1;
int
milliseconds = 500;
byte
[] packet =
new
byte
[q];
Ping myPing =
new
Ping();
PingReply reply;
while
(
true
)
{
Thread.Sleep(milliseconds);
reply = myPing.Send(ping1.Text, milliseconds, packet);
if
(reply.Status == IPStatus.Success)
{
result1.AppendText(
"Reply from = "
+ reply.Address +
" Bytes = "
+ reply.Buffer.LongLength +
" Time = "
+ reply.RoundtripTime +
" TTL = "
+ reply.Options.Ttl);
result1.AppendText(Environment.NewLine);
}
else
{
result1.AppendText(reply.Status.ToString());
result1.AppendText(Environment.NewLine);
}
}
}
Reply
Answers (
3
)
Need help for Ping Software
Message Box Edit Help Me?