Async - Pinging All Computers In List

Nov 24, 2011

I've run into a bit of a problem using Async ping. Basically, I want to ping computers in the list before I run the next bit of my program. The computers who I can ping are added to a list and that is used in a background worker. Trouble is can't seem to work out how to wait until after pinging ALL computers in the list, either successful or timed-out. Is there something a long the lines of 'If Async Ping is running'?

Private Sub pingCompleted(ByVal sender As Object, ByVal e As System.Net.NetworkInformation.PingCompletedEventArgs)
If e.Reply.Status = Net.NetworkInformation.IPStatus.Success Then
complist.Add(e.UserState)
Else
'do nothing
End If
End Sub

I need the next bit to wait because if 'complist' is changed while it's being used I get collection errors.

View 7 Replies


ADVERTISEMENT

Pinging A List Of Machines?

Feb 1, 2012

I have a list of machines, 1 per line in a file called devices.txt.

What I need to be able to do is to ping each of these machines, and then output each machine that is online to another text file called machines.txt

The files need to just be the machine name and have 1 machine per line.

View 1 Replies

Making An Async Function Not Async?

Jun 3, 2010

I'm trying to write a 'developer friendly' wrapper for the Windows API EnumWindows - the problem is that the API uses a callback function that gets invoked on another thread, where as I want my wrapper function to simplify this and make it more useful by working like any other normal synchronous function and just returning a value.

Now if the API just called the callback once that would be fine, as I would just call the API and make the wrapper function wait until it got a signal from the callback function telling it to continue... but the API calls the callback function over 100 times (once for every window handle that exists). The biggest problem is that there is nothing that indicates that any particular call to this callback function is the last one, so my wrapper function has no idea when it is safe to continue and return the list of window handles to the caller.

The only solution I could think of is to do this:

1. The wrapper function calls the API and starts a timer that waits 2 seconds before it raises the Elapsed event. The wrapper function then pauses until it receives a signal (ManualResetEvent)

2. Each time the callback function is raised by the API on a different thread, it stops the timer (so this is before the 2 seconds have elapsed), adds the current window handle that was passed in by the API to the list of handles, then starts the timer again.

3. If the timer reaches its 2 second interval then it is assumed that we are at the end of the windows because otherwise the callback would have stopped the timer. So the timer's Elapsed event handler is what signals the original thread (that the wrapper function is executing on) to continue as we now have a complete list of windows to return.

This works fine and does exactly what I want... but I dont like it.

I dont like forcing the caller to wait an extra 2 seconds after the API has done its last callback but more importantly I dont like assuming that the API will never take longer than 2 seconds between callbacks. In reality on my PC it is never anywhere near that long between callbacks, it is something like 200 miliseconds, but I have no idea how long it would be on a slower PC and I want this to be completely reliable.

[URL]

View 14 Replies

Get List Of Computers From An OU In AD?

Aug 22, 2011

I am using VB to develop a WinForms application. This application should get all the computers from a particular Oraganizational Unit (OU) in the Active Directory (AD). How do I specify the particular OU in VB code? I would prefer to download some fields only from each computer's record.

View 1 Replies

Get List Of Connected Computers

Jan 9, 2009

how do i get list of all connected computers in local network i have tried through Active Directory and it gives all computer names whether connected or not. the main problem is few computers on network have dual operating systems and both have different name like different on xp (comp1 xp) and different on vista (comp1 vista) and when i try to ping a computer name like (comp1 vista) which is not active, but maps to its associated ip and return replying so i m not able to get true status of computer name as (comp1 xp) can also reply on ping

View 15 Replies

List All Computers In Network/Workgroup?

Dec 29, 2007

How can i get a List of all Arivable Computers in my Network/Workgroup ? I need to add all to a Listbox

View 7 Replies

List All Computers On The Network With 2008?

Apr 11, 2010

I wonder how do I list all computers on the network with vb 2008?I know to do in vb6 I have no more sense in vb 2008.

View 2 Replies

Wired <-> Wireless Network Communication - Grab A List Of All Networked Computers?

Mar 28, 2010

My issue, however, is connecting to the wireless laptops as well.

[code...]

I need to grab a list of all networked computers, and I definitely include systems on the wireless

network in that list. I'm just not sure how to approach this. Being able to enumerate through a

'tree' of all networks and systems available would be a major plus.

View 5 Replies

Pinging Range Of IPs

Aug 13, 2009

I got help with pinging a range of IPs earlier and was given this code. I was then trying to change it slightly so I could scan more than my network between any given range e.g. 125.1.1.1 to 126.12.25.66.[code]

View 3 Replies

Pinging Range Of Whole Network?

Jul 28, 2009

I want a start IP and end IP and it to ping all the IPs between and including those IPs. I've seen examples of when it gets the subnet and then iterates through from 0 to 255 but I'm struggling with this. Is there a way to make an IP address object (is this the right word?) that iterates the same way as an IP would e.g.goes from 192.168.1.255 then would go to 192.168.2.0.

[Code]...

View 1 Replies

VS 2010 Pinging A Server

Aug 1, 2011

recently ive been making a app for minecraft and im trying to add a new feature what i want it to do is ping the server and then tell me if its on or off any server using a redirector like dyndns or no-ip will ping back as online even if they are offline because the redirector isn't down or.[code]

View 6 Replies

Pinging Email Addresses To See If They Exist?

May 5, 2010

Ping Email Address to see if it exists.

I would like to ping an email to see if it exists. Does anyone know how I can accomplish this?

View 5 Replies

Visual Studio - How To Disable Pinging During Tests

Jun 9, 2012

I have a class that uses My.Computer.Network.Ping to get a boolean value on whether a IP address or hostname is reachable.However, when I'm testing that class, I want to disable pinging so that during the test whenever I run the My.Computer.Network.Ping it will always return false or throw some kind of exception.

I have tried the following, but I still get a true returned (meaning, the attempts to disable ping didn't work)

Dim restricited As New System.Net.NetworkInformation.NetworkInformationPermission(System.Security.Permissions.PermissionState.None)
Dim mySocketPermission1 As New SocketPermission(PermissionState.None)
Dim myWebPermission As New WebPermission(PermissionState.None)
myWebPermission.Demand()'

[Code]...

View 1 Replies

List All Power Off, Power On Computers In Local Network?

Jul 26, 2010

Im coding an application that needs to list all computers inside my LAN, and get the status of the machines ex. Power On, Power Off.. in order to Wake On Lan, or Turn it Off.. im using Visual Basic .Net.I all ready listed all machines, now i need to get the status of them..

View 5 Replies

IP Address Filter Or Mask To Only Allow Valid IP Address Before Pinging Or Testing For Network Connection

Jul 6, 2011

Are there any IP Address filters or masks available in Windows Forms as per following screenshot? A backslash shouldn't be allowed or it should be filtered somehow.

View 1 Replies

VS 2008 - Threaded Ping - Click Another Site While Its Still Pinging Them It Doesn't Wait Before It Switches Site

Feb 9, 2010

Ive got an app that holds a list of site we have, At each site there are a few devices. The idea is when they click on a site all the details for the site are loaded and then a second thread sits and pings each device to see if its live. Im trying to do this in a seperate thread so if they click another site while its still pinging them it doesn't wait before it switches site. This all seems to be workling fine except if you click through the sites quickly, when you do that it will eventually come up with

Quote:

{"Collection was modified; enumeration operation might not execute."}

The error flags up on the "Next" line in "ThreadedPing"

Thread stuff

Public Sub ThreadedPing(ByVal dt As DataTable)
Try

Dim dr As DataRow

[CODE]...

View 2 Replies

"Pinging" An Email Address Using Coding

May 24, 2012

Is there a way in VB.Net to "Ping" an email address to see if that email is a real one that does not give any errors?

If yes, can you show what the VB.Net coding looks like to implement this?

I plan to use this in an app that requires the Customer email and it would be nice to validate it as the call taker enters it into a form before saving the Customer details.

Here is the code we are using to send an email promotion to all of the customers in our customer table:

Private Sub RibbonButtonSendTestEmail_Click(sender As System.Object, e As System.EventArgs) Handles RibbonButtonSendTestEmail.Click
Dim SmtpServer As New SmtpClient()

[Code].....

View 2 Replies

C# - Using Async Methods Asp.net?

Jul 15, 2010

I have two methods on the page. One AddMessageToInboxOutbox(params[]) and other one SendNewMessageMail(params[]).

Once user sends an message to other other first message is added to DB and then sent to recipient's email. Sometimes SMTP is heavy loaded and it takes up to 5 seconds to get answer from it. I want to enclose SendNewMessageMail(params[]) with async call using other thread or something. I have never done that.

How do i perform this action right in ASP.NET?

View 2 Replies

Wpf - Update UI Async?

Nov 3, 2011

[Code]...

In my scenario the Button_Click is a command delegate in the VM, and the Thread.Sleep is some long-running process (about 2-10 seconds). I want, that when the user calls the command, it should immediately update the UI disabling the button so the user cannot execute it while it's running, then execute that operation, then, when operation completed, unblock the button.

[Code]...

View 3 Replies

Async Callback From ThreadPool?

Jun 12, 2009

I have a bunch of operations that need to be executed simultaneously. For this I'm using the thread pool to execute the tasks. I'd like to know if it's possible to consume some sort of Async Callback (similar to BackgroundWorker.DoWorkComplete) when each thread is finished. The reasoning behind this is that I have a windows service running that uses IPC to update a GUI and I need to know the time at which each specific thread finishes I've used background workers to do a set of tasks and they work perfectly, however, they take longer than I would like. I've timed the execution on my BGW method for a designated number of said tasks and it took 27 seconds, and the same set of tasks takes 4 seconds using the threadpool method. I've also tried using managed threads, to the same effect as the background workers.

View 5 Replies

C# - .NET Async Lambda-expressions?

Apr 20, 2012

Async Sub like this: Dim f As Func(Of Task) = Async Sub() End Sub Produces compiler error: error BC36670: Nested sub does not have a signature that is compatible with delegate 'System.Func(Of System.Threading.Tasks.Task)'.Equivalent C# code compiles fine:

Func<Task> f = async () => { };Rewriting Async Sub into Async Function make code works.

Why does Async Sub() is not convertible to delegate types with return value of type Task?

View 1 Replies

How To Make WebRequest ASync

Oct 1, 2011

I think this is a simple question for you, but I don't understand other cases of webRequests, so I asked here: How can I make this webRequest asynchronous?
Dim sBuffer As String
Dim oRequest As WebRequest = WebRequest.Create(url)
oRequest.Method = "GET"
Dim oResponse As WebResponse = oRequest.GetResponse()
Dim oStream As New StreamReader(oResponse.GetResponseStream())
[Code] .....

View 1 Replies

Using Async CTP Await With Events?

Jul 15, 2011

Relevant to Silverlight 5 / Async CTP

I want to create an asynchronous function that initiates a layout update and then Awaits for the layout update to complete. Something like:

Private Async Function UpdateLayoutRoot() As Task
LayoutRoot.UpdateLayout()
Await LayoutRoot.LayoutUpdated <--- (NOT valid but shows desired outcome)
End Function

How can this be done? More generally, how can you use Await to wait for existing events?

View 2 Replies

Wpf - HttpWebRequest.BeginGetResponse Is Not Async?

Mar 31, 2011

I have some code that iterates a few 100 urls and requests the data from the web.It looks something like this

for each url in urls
Dim hwr = CType(WebRequest.Create(url), HttpWebRequest)
Dim rq = New ReqArgs

[code]....

How come the BeginGetresponse line takes about 2-3 seconds to complete before going to dim a=1?. Actually I debugged and I see that the FinishWebRequest procedure runs completely before the Dim a=1 is reached.So is this async?I'm not earning any time by using the async. am I? Or is there a different way to do this?The point is that the main sub should fire off 300 requests and return control to the UI, then the FinishWebRequest should process them slowly on its own thread and own time , as the requests come in.How do I do that?Btw, the main sub is running in a BackgroundWorker, but I checked with out the BackgroundWorker and the problem is the same?

View 1 Replies

.net - Using Task For Async Operation But UI Is Still Unresponsive

Jun 14, 2012

I have a WPF application in which i have to do a long running task (basically reading from network). Just to give you a snapshot I am doing the following thing on button click

Dim t As Task(Of String) = Task.Factory.StartNew(Of String)(Function()
'Thread.sleep is simulating long running task that will make UI unresponsive
Thread.Sleep(10000)

[Code].....

I cannot use Event based async methodology because the reading API actually exist in a dll which i refer in my program, that contains a function Public function ReadFromNetwork() as String. This API is making an async call to network to read a long string and return to UI. So, in short i m doing TextBlock1.Text = ExternalDll.ReadFromNetwork().

but the problem is that even if i use Task asynchrony, the UI is still unresponsive.

View 3 Replies

Async Connect From VB 6 To VB 2008 Express

Dec 21, 2009

I am working on moving a project from VB6 to VB 2008 Express. [Code] When I connect to mysql db in VB6, I connect using adAsynConnect. This way, I have a "Loading..." animation display while a connection is attempted. Is there a way to do this in 2008 Express? Or something similar I could read up on?

View 4 Replies

Async Sockets Client-server?

Jul 25, 2011

I'm using vb .net 2008 with 3.5 framework. (the following 2 classes are put in a DLL that i import in a main application)

Server class:

Code:
Imports System.Xml
Imports System.Net.Sockets
Imports System.Text
Imports System.Net

[code]....

Basically in my main application i am instantiating the client class from this dll, as well as the server one. On the client form i got a "send data" (SendFISA sub) and a "connect" button. After connecting the client and clicking on the "send data" i am sending to the server a string formed of some information created when instantiating the client class from the dll (i can't make that type of data public, but i'm just using a constructor to assign values to a class object, nothing special).

Now, when the server receives the data sent by "send data" button click it responds with "PKG_SENT" corresponding to the "FISASENT" string terminator(in the module) of the string that was sent. The "WRONG_MSG" constant is for when the string terminator is different from the 2 from above.

On the local disk, if the server cannot be reached, the client saves an xml file with this data. In the dll i made a timer that ticks every 5 seconds and checks to see if there is any xml file on the disk and sends it to the server if the connection is ok (trimiteXML sub). The server would respond with "XML_SENT" corresponding to the string terminator "XMLSENT"(in the module) appended to the read string from the xml file. After the file is sent it is deleted from the local dir.

The problem occurs when i click "send data" AND there are XML files to be sent from the disk. I believe they are interpreted by the server somehow at the same time because the message is neither "PKG_SENT" nor "XML_SENT", but it becomes a combination of the "WRONG_MSG_TYPE" and "XML_SENT", "XML_SENTG_TYPE". I have no idea why this is happening and i basically want the socket to wait with sending the files from the disks until the "send data" finishes.

View 9 Replies

Async Web Service Call Within Console App

Nov 24, 2009

I have a console app that is supposed to async call a web service...i don't get any errors but the completed handler doesn't seem to complete correctly. I have a subroutine with a loop that is supposed to fire off say 6 seperate calls to another routine that calls the service. The completed event handler routine puts data into the database..If i put a thread.sleep under the call to the routine calling the web service. The completed event handler fires but only one record is put in the database instead of the hundreds expected and only that one webservice call appears to fire.I should mention that this works as expected when calling the sync method of the web service within a console app and the asyc calls work as expected from a windows forms app. I just need it to work async within a console app..

View 1 Replies

Cannot Receive More Than 1 Response With Async Sockets

Jun 16, 2009

I'm trying to setup an asynchronous client and I can send/receive one command and response, but when I try to send the second command, the command is sent (I verified by code inspection), but I am getting no response.

Heres the code, a majority of it is from the Microsoft example.

Option Explicit On
Imports System
Imports System.Net

[Code].....

View 1 Replies

Clean Up App And Deal With The Async Calls?

Mar 16, 2010

My app is basically talking to a device via RS232. I need to 'listen' to the data received and do certain things based on it, update labels, etc. When I started, I only had a couple cross-thread calls and I used JMC's example to get by that. Now my app is bigger and I am calling the ThreadProcSafe all the time. I am hoping there is an easier way so I don't have to create sub routines for every control. Here's the relevant parts of my code.

Private Sub StepperSerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles StepperSerialPort.DataReceived
Dim ReceiveBuffer As String

[Code].....

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved