By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,290 Members | 1,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,290 IT Pros & Developers. It's quick & easy.

Ping in VB.Net

P: n/a
Is there a way to do a plain ping operation in VB.Net
using only .Net libraries?

Thanks

Rudolf
Nov 20 '05 #1
Share this Question
Share on Google+
24 Replies


P: n/a
VB6:

http://www.mvps.org/vbnet/index.html...ernet/ping.htm

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Chaos, Panic, Disorder, my work here is done"
"Rudolf" <Ru*****@Hotmail.com> wrote in message
news:0f****************************@phx.gbl...
: Is there a way to do a plain ping operation in VB.Net
: using only .Net libraries?
:
: Thanks
:
: Rudolf
Nov 20 '05 #2

P: n/a
Hello,

"Tom Spink" <th**********@ntlworld.com> schrieb:
VB6:

http://www.mvps.org/vbnet/index.html...ernet/ping.htm


| using only .Net libraries?

?!?

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

P: n/a
Hello,

"Rudolf" <Ru*****@Hotmail.com> schrieb:
Is there a way to do a plain ping operation in VB.Net
using only .Net libraries?


http://www.csharphelp.com/archives2/archive296.html
http://www.c-sharpcorner.com/network/ping.asp

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4

P: n/a
Cor
Hi Herfried,

http://www.csharphelp.com/archives2/archive296.html
http://www.c-sharpcorner.com/network/ping.asp

| using only VB.Net?
?!?
;-)
Do you know someone who can put that rewritten in VB after his Whois
example?
:-)
Cor
Nov 20 '05 #5

P: n/a
Hi Cor,

You need it? I could do it for you.

Regards,
Fergus
Nov 20 '05 #6

P: n/a
Hello,

"Cor" <no*@non.com> schrieb:
http://www.csharphelp.com/archives2/archive296.html
http://www.c-sharpcorner.com/network/ping.asp

| using only VB.Net?
?!?
;-)
Do you know someone who can put that rewritten in VB
after his Whois example?


What exactly do you want to do? Do you want to convert the code to VB.NET?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #7

P: n/a
Cor
Hi Fergus,
My message is gone at my provider

No I thought for people who ask for it, that is often for this,

But funny is, that I had origanaly written.
Do you know someone who can put that rewritten in VB after his Whois
example?
And when you have no time maybe Fergus will help you.


But that was something I thought I could not do
:-)

I begin starting to think about a FCN-sample site

Cor
Nov 20 '05 #8

P: n/a
Whoa, didn't see that, thanks Herfried...

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Chaos, Panic, Disorder, my work here is done"
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:##**************@TK2MSFTNGP09.phx.gbl...
: Hello,
:
: "Tom Spink" <th**********@ntlworld.com> schrieb:
: > VB6:
: >
: > http://www.mvps.org/vbnet/index.html...ernet/ping.htm
:
: | using only .Net libraries?
:
: ?!?
:
: ;-)
:
: --
: Herfried K. Wagner
: MVP · VB Classic, VB.NET
: http://www.mvps.org/dotnet
:
:
Nov 20 '05 #9

P: n/a
Hi Cor,

FCN ? Fergus-Cor-Nick ??

Fergus
Nov 20 '05 #10

P: n/a
Cor
> FCN ? Fergus-Cor-Nick ??

Yes what else?
:-)
Nov 20 '05 #11

P: n/a
Hello,

"Cor" <no*@non.com> schrieb:
FCN ? Fergus-Cor-Nick ??

Yes what else?
:-)


Why not FCNH?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #12

P: n/a
Hi Herfried,

Are you inviting us to join you on your site?

;-D

Regards,
Fergus

FCNH [Friendly Cor - Notable Humanitarian]
Nov 20 '05 #13

P: n/a
Hello,

"Fergus Cooney" <fi******@tesco.net> schrieb:
Are you inviting us to join you on your site?
What exactly do you mean?
FCNH [Friendly Cor - Notable Humanitarian]


;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #14

P: n/a
Hi Herfried,

Cor
|| I begin starting to think about a FCN-sample site
|| FCN - Fergus, Cor, Nick

Gang of three - needs a web site.

Herfried
|| Why not FCNH?

Indeed, we must have Herfried! ;-)
Gang of four - still needs a web site.

Fergus
|| Are you inviting us to join you on your site?

Herfied's <got> a web site!!

Hey guys - Party at Herfried's!! - Woohoo!! ;-) ;-) ;-)

:-D

Regards,
Fergus
Nov 20 '05 #15

P: n/a
Hello,

"Fergus Cooney" <fi******@tesco.net> schrieb:
Cor
|| I begin starting to think about a FCN-sample site
|| FCN - Fergus, Cor, Nick

Gang of three - needs a web site.

Herfried
|| Why not FCNH?

Indeed, we must have Herfried! ;-)
Gang of four - still needs a web site.

Fergus
|| Are you inviting us to join you on your site?

Herfied's <got> a web site!!

Hey guys - Party at Herfried's!! - Woohoo!! ;-) ;-) ;-)


LOL...

;-)))

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #16

P: n/a
Cor
Herfried,
I start to think where we can make FCNH

(Webform or JavaScript Site is the problem)

Cor
Nov 20 '05 #17

P: n/a
I want to build a ping type monitor app. I've done it before for VB 6 but
now want to do it completely over in VB.net. I did find some .Net samples
but they are using raw sockets which is not allowed/blocked on the machine
it is running on. The old ping.exe util does still work on it though.

Only if there is no other way will I try to use winapi calls again.

thanks

Rudolf

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
Hello,

"Cor" <no*@non.com> schrieb:
http://www.csharphelp.com/archives2/archive296.html
http://www.c-sharpcorner.com/network/ping.asp

| using only VB.Net?
?!?
;-)
Do you know someone who can put that rewritten in VB
after his Whois example?


What exactly do you want to do? Do you want to convert the code to VB.NET?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #18

P: n/a
I attempted to do an upgrade of the vb6 code using winapi calls but this
also does not work.

When calling the WSAStartup function (in SocketsInitialize) I get a stack
overflow error. I tried different variations of the WSADATA structure but it
does not help.

The following is the declarations:

Private Structure WSADATA
Dim wVersion As Short
Dim wHighVersion As Short
<VBFixedArray(MAX_WSADescription)> Dim szDescription() As Byte
<VBFixedArray(MAX_WSASYSStatus)> Dim szSystemStatus() As Byte
Dim wMaxSockets As Integer
Dim wMaxUDPDG As Integer
Dim dwVendorInfo As Integer

Public Sub Initialize()
ReDim szDescription(MAX_WSADescription)
ReDim szSystemStatus(MAX_WSASYSStatus)
End Sub
End Structure
Const WS_VERSION_REQD As Integer = &H101s

Private Declare Function WSAStartup Lib "wsock32" (ByVal wVersionRequired As
Integer, ByRef lpWSADATA As WSADATA) As Integer

When called like this:

Dim WSAD As WSADATA
WSAD.Initialize()
If WSAStartup(WS_VERSION_REQD, WSAD) = IP_SUCCESS Then ...

It gives a stack overflow error.

What must the declarations look like to word?

thanks

Rudolf

"Rudolf Henning" <Ru****@Hen.co.za> wrote in message
news:eR**************@TK2MSFTNGP11.phx.gbl...
I want to build a ping type monitor app. I've done it before for VB 6 but
now want to do it completely over in VB.net. I did find some .Net samples
but they are using raw sockets which is not allowed/blocked on the machine
it is running on. The old ping.exe util does still work on it though.

Only if there is no other way will I try to use winapi calls again.

thanks

Rudolf

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
Hello,

"Cor" <no*@non.com> schrieb:
> http://www.csharphelp.com/archives2/archive296.html
> http://www.c-sharpcorner.com/network/ping.asp
>
| using only VB.Net?
?!?
;-)
Do you know someone who can put that rewritten in VB
after his Whois example?


What exactly do you want to do? Do you want to convert the code to VB.NET?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Nov 20 '05 #19

P: n/a
I feel left out....

FCNHT

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Chaos, Panic, Disorder, my work here is done"
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:Ow**************@TK2MSFTNGP09.phx.gbl...
: Hello,
:
: "Fergus Cooney" <fi******@tesco.net> schrieb:
: > Cor
: > || I begin starting to think about a FCN-sample site
: > || FCN - Fergus, Cor, Nick
: >
: > Gang of three - needs a web site.
: >
: > Herfried
: > || Why not FCNH?
: >
: > Indeed, we must have Herfried! ;-)
: > Gang of four - still needs a web site.
: >
: > Fergus
: > || Are you inviting us to join you on your site?
: >
: > Herfied's <got> a web site!!
: >
: > Hey guys - Party at Herfried's!! - Woohoo!! ;-) ;-) ;-)
:
: LOL...
:
: ;-)))
:
: --
: Herfried K. Wagner
: MVP · VB Classic, VB.NET
: http://www.mvps.org/dotnet
:
:
Nov 20 '05 #20

P: n/a
Hello,

"Tom Spink" <th**********@ntlworld.com> schrieb:
I feel left out....

FCNHT


ROFL

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #21

P: n/a
Cor
Hi,
Ok Ok Ok
But then minimal
FCNHTA
I will real start thinking(working) for it after my HKW (is on the route).
Cor
Nov 20 '05 #22

P: n/a
Hello,

"Cor" <no*@non.com> schrieb:
Ok Ok Ok
But then minimal
FCNHTA
I will real start thinking(working) for it after my HKW
(is on the route).


ROFL

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #23

P: n/a
Hi Rudolf,

I'm sorry for kept you for so long. I've done some research on this issue
and wrote a short sample. Please define the WSADATA structure like the
following:

Private Const WSADESCRIPTION_LEN = 256

<StructLayout(LayoutKind.Sequential)> _
Public Structure WSADATA

Public wVersion As Short
Dim wHighVersion As Short

<MarshalAs(UnmanagedType.ByValTStr, sizeConst:=WSADESCRIPTION_LEN +
1)> _
Public szDescription As String
<MarshalAs(UnmanagedType.ByValTStr, sizeConst:=WSADESCRIPTION_LEN +
1)> _
Public szSystemStatus As String
Public iMaxSockets As Integer
Public iMaxUdpDg As Integer
Public lpVenderInfo As IntPtr

End Structure

Private Declare Function WSAStartup Lib "wsock32" (ByVal
wVersionRequired As Integer, ByRef lpWSADATA As WSADATA) As Integer

In your codes you can use it as:

Dim Data As New WSADATA
If WSAStartup(&H201, Data) = 0 Then
'Codes of your logic
End If

HTH

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "Rudolf" <Ru*****@Hotmail.com>
| References: <0f****************************@phx.gbl>
<Or**************@TK2MSFTNGP09.phx.gbl>
<3f***********************@reader22.wxs.nl>
<u4**************@tk2msftngp13.phx.gbl>
<eR**************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: Ping in VB.Net
| Date: Wed, 24 Sep 2003 15:37:59 +0200
| Lines: 82
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#M**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: 165.165.25.85
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:140910
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I attempted to do an upgrade of the vb6 code using winapi calls but this
| also does not work.
|
| When calling the WSAStartup function (in SocketsInitialize) I get a stack
| overflow error. I tried different variations of the WSADATA structure but
it
| does not help.
|
| The following is the declarations:
|
| Private Structure WSADATA
| Dim wVersion As Short
| Dim wHighVersion As Short
| <VBFixedArray(MAX_WSADescription)> Dim szDescription() As Byte
| <VBFixedArray(MAX_WSASYSStatus)> Dim szSystemStatus() As Byte
| Dim wMaxSockets As Integer
| Dim wMaxUDPDG As Integer
| Dim dwVendorInfo As Integer
|
| Public Sub Initialize()
| ReDim szDescription(MAX_WSADescription)
| ReDim szSystemStatus(MAX_WSASYSStatus)
| End Sub
| End Structure
| Const WS_VERSION_REQD As Integer = &H101s
|
| Private Declare Function WSAStartup Lib "wsock32" (ByVal wVersionRequired
As
| Integer, ByRef lpWSADATA As WSADATA) As Integer
|
| When called like this:
|
| Dim WSAD As WSADATA
| WSAD.Initialize()
| If WSAStartup(WS_VERSION_REQD, WSAD) = IP_SUCCESS Then ...
|
| It gives a stack overflow error.
|
| What must the declarations look like to word?
|
| thanks
|
| Rudolf
|
| "Rudolf Henning" <Ru****@Hen.co.za> wrote in message
| news:eR**************@TK2MSFTNGP11.phx.gbl...
| > I want to build a ping type monitor app. I've done it before for VB 6
but
| > now want to do it completely over in VB.net. I did find some .Net
samples
| > but they are using raw sockets which is not allowed/blocked on the
machine
| > it is running on. The old ping.exe util does still work on it though.
| >
| > Only if there is no other way will I try to use winapi calls again.
| >
| > thanks
| >
| > Rudolf
| >
| > "Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
| > news:u4**************@tk2msftngp13.phx.gbl...
| > > Hello,
| > >
| > > "Cor" <no*@non.com> schrieb:
| > > > > http://www.csharphelp.com/archives2/archive296.html
| > > > > http://www.c-sharpcorner.com/network/ping.asp
| > > > >
| > > > | using only VB.Net?
| > > > ?!?
| > > > ;-)
| > > > Do you know someone who can put that rewritten in VB
| > > > after his Whois example?
| > >
| > > What exactly do you want to do? Do you want to convert the code to
| VB.NET?
| > >
| > > --
| > > Herfried K. Wagner
| > > MVP · VB Classic, VB.NET
| > > http://www.mvps.org/dotnet
| > >
| > >
| >
| >
|
|
|

Nov 20 '05 #24

P: n/a
Thanks, I'll have a look at it again.

Rudolf

-----Original Message-----
Hi Rudolf,

I'm sorry for kept you for so long. I've done some research on this issue and wrote a short sample. Please define the WSADATA structure like the following:

Private Const WSADESCRIPTION_LEN = 256

<StructLayout(LayoutKind.Sequential)> _
Public Structure WSADATA

Public wVersion As Short
Dim wHighVersion As Short

<MarshalAs(UnmanagedType.ByValTStr, sizeConst:=WSADESCRIPTION_LEN + 1)> _
Public szDescription As String
<MarshalAs(UnmanagedType.ByValTStr, sizeConst:=WSADESCRIPTION_LEN + 1)> _
Public szSystemStatus As String
Public iMaxSockets As Integer
Public iMaxUdpDg As Integer
Public lpVenderInfo As IntPtr

End Structure

Private Declare Function WSAStartup Lib "wsock32" (ByVal wVersionRequired As Integer, ByRef lpWSADATA As WSADATA) As Integer
In your codes you can use it as:

Dim Data As New WSADATA
If WSAStartup(&H201, Data) = 0 Then
'Codes of your logic
End If

HTH

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no rights."

--------------------
| From: "Rudolf" <Ru*****@Hotmail.com>
| References: <0f****************************@phx.gbl>
<Or**************@TK2MSFTNGP09.phx.gbl>
<3f***********************@reader22.wxs.nl>
<u4**************@tk2msftngp13.phx.gbl>
<eR**************@TK2MSFTNGP11.phx.gbl>
| Subject: Re: Ping in VB.Net
| Date: Wed, 24 Sep 2003 15:37:59 +0200
| Lines: 82
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#M**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: 165.165.25.85
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl! tk2msftngp13.phx.gbl| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:140910| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I attempted to do an upgrade of the vb6 code using winapi calls but this| also does not work.
|
| When calling the WSAStartup function (in SocketsInitialize) I get a stack| overflow error. I tried different variations of the WSADATA structure but it
| does not help.
|
| The following is the declarations:
|
| Private Structure WSADATA
| Dim wVersion As Short
| Dim wHighVersion As Short
| <VBFixedArray(MAX_WSADescription)> Dim szDescription() As Byte| <VBFixedArray(MAX_WSASYSStatus)> Dim szSystemStatus() As Byte| Dim wMaxSockets As Integer
| Dim wMaxUDPDG As Integer
| Dim dwVendorInfo As Integer
|
| Public Sub Initialize()
| ReDim szDescription(MAX_WSADescription)
| ReDim szSystemStatus(MAX_WSASYSStatus)
| End Sub
| End Structure
| Const WS_VERSION_REQD As Integer = &H101s
|
| Private Declare Function WSAStartup Lib "wsock32" (ByVal wVersionRequired As
| Integer, ByRef lpWSADATA As WSADATA) As Integer
|
| When called like this:
|
| Dim WSAD As WSADATA
| WSAD.Initialize()
| If WSAStartup(WS_VERSION_REQD, WSAD) = IP_SUCCESS Then ...|
| It gives a stack overflow error.
|
| What must the declarations look like to word?
|
| thanks
|
| Rudolf
|
| "Rudolf Henning" <Ru****@Hen.co.za> wrote in message
| news:eR**************@TK2MSFTNGP11.phx.gbl...
| > I want to build a ping type monitor app. I've done it before for VB 6 but
| > now want to do it completely over in VB.net. I did find some .Net samples
| > but they are using raw sockets which is not allowed/blocked on the machine
| > it is running on. The old ping.exe util does still work on it though.| >
| > Only if there is no other way will I try to use winapi calls again.| >
| > thanks
| >
| > Rudolf
| >
| > "Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message| > news:u4**************@tk2msftngp13.phx.gbl...
| > > Hello,
| > >
| > > "Cor" <no*@non.com> schrieb:
| > > > > http://www.csharphelp.com/archives2/archive296.html| > > > > http://www.c-sharpcorner.com/network/ping.asp
| > > > >
| > > > | using only VB.Net?
| > > > ?!?
| > > > ;-)
| > > > Do you know someone who can put that rewritten in VB| > > > after his Whois example?
| > >
| > > What exactly do you want to do? Do you want to convert the code to| VB.NET?
| > >
| > > --
| > > Herfried K. Wagner
| > > MVP · VB Classic, VB.NET
| > > http://www.mvps.org/dotnet
| > >
| > >
| >
| >
|
|
|

.

Nov 20 '05 #25

This discussion thread is closed

Replies have been disabled for this discussion.