How To Use Infinite Loops In Event Listener

May 1, 2012

I am trying to build a small window component, which has two buttons.

When I click on the Start button, my code needs to establish the connection to server and keep checking the status (this is infinite loop, I have a boolean global variable which is set to true and based on this loop will work).

When I click on stop button, it should stop checking (I will make global variable to false).

I have code to check my server status.

However, since it is kind of infinite loop, moment i click on start, window form is not taking any other actions, since the control not coming out of event listener of start button.

I have many scenarios like this kind of infinite loops.

How to resolve this, what kind of approch should i follow in vb.

View 8 Replies


ADVERTISEMENT

Add Listener (event) To A Program?

Nov 14, 2011

I'm writing an add on to an existing program through an API, but the event I need doesn't exist. How do i go about creating my own event in VB.

I'm writing a plug-in for a program called promis-e that works in conjunction with Microstation CAD platform to generate electrical drawings.I need to call a function I wrote when a new symbol is added to the active drawing, but that event isn't available in promise, so I was wondering if I could write my own event in Microstation that calls that function ?

View 1 Replies

Event Driven Tcp Listener Method?

Aug 23, 2011

I'm another newbie with VB (2010) so please bear with me. I am attempting to make a method that is event driven by data threads on the Ethernet port. Simply put, the method is to wait until a data thread from a "Control By Web" 5-input device sends an "information update" data packet to the application, with the application then processing the information. This application is on a private, well controlled network, with no access to the internet. I have a method that is working right now reading data packets when invoked with a timer (see code below) but I really need it to be event driven.

' this is added at the top of the class
Dim tcplistener As New TcpListener(IPAddress.Any, ip_port)
'this is added in the "form1_load" module

[code]....

View 1 Replies

Javascript - Register A Client-side Event Listener On A Server-side Event?

Dec 28, 2011

Ultimately, what I want to accomplish is an AJAX-based messaging system. I already have a database table for messages, and an ASPX to add new messages (and declare old messages no longer relevant).

The current messaging system simply polls the server every 15 seconds, and re-pulls the current message set.

What I am looking to do is: On $(document).ready(), register an ajax callback function that listens for a server-side event (e.g., MessagesUpdated) On table insert/update, fire MessagesUpdated server-side.

This way, whenever the table is updated (or new records added), any clients listening know that new data is available and can re-poll the server then.

Ideally, I'd also like to make the new data available as an event argument (to minimize re-polling the db).

I can find references to something like this in other languages, but I cannot find any actual code examples to get me started.

Assuming this is possible to do via .Net, can anyone help get me started on this?

I'm using the 2.0 Framework. Also while I added a VB.Net tag, I can read C# reasonably well, so please feel free to post in either language.

View 4 Replies

VS 2008 - Infinite Loop - Event Triggered Keeps Firing Off The Code

May 9, 2010

I'm not even sure what I need to know. None the less lets say I got a timer with an if event to check if said event is triggered then it fires off some code. The problem is if said event is triggered it keeps firing off the code and I only need to do it one time. Whilst letting the timer keep checking if event happened. I hope I worded that right and here is a rough translation in code. [Code] Is there a way to keep checking if an event happened and only fire off the code one time?

View 1 Replies

Monthly Payment Calculation, For Loops To Do While Loops?

Oct 8, 2011

the purpose of the program is to display the monthly payments on the loan.My homework is to use do while loops instead of for loop.Here is the code for the for loop.

Option Explicit On
Option Strict On
Option Infer Off

[code].....

Now I'm having some trouble displaying the output using the do while loop, and I'm pretty sure it's a loop problem on my code. However, I cannot seemed to find out what's wrong. I looked at the examples of do while loop in my textbook, but I couldn't find anything useful to my problems of my program.This is the output for the do while loop.

Here's the do while loop code

Option Explicit On
Option Strict On
Option Infer Off

[code].....

View 3 Replies

Contain Functions(They All Have For Loops) Don't Work In For Loops?

Mar 6, 2011

When I use a For loop in a For loop the Contains Statement dosen't work! Even my custom one! I even tested mine and it works 100% And neither that or the String.Contains function work inside of For Loops And, I know both of them use loops to search through a string.

My function(It will atleast search once):

Function RealContains(ByVal load As String, ByVal needle As String) As Boolean
load = load.ToLower

[CODE].....................

View 10 Replies

Add Winsock Listener In Program?

Nov 1, 2009

How to add winsock listener in Vb 2008

View 1 Replies

Communications :: TcpClient/Listener ?

Jan 16, 2010

I'm having a hard time getting the fundamentals down about these TCP Socket classes.

When you use TcpClient, you can set the IP Address or domain name to connect to the server end of the socket. I see examples that use "localhost" as the first parameter for TcpClient. Is this just a broadcast over the network to find the server that has a TcpListener listening on the dictated port of the second parameter of the TcpClient declaration? With any IP address for TcpClient (I realize that's an option, though), how does "localhost" find the TcpListener server?

View 8 Replies

Create A Http Listener?

Jan 4, 2010

create a http listener using vb .net.

View 1 Replies

Stop A Listener Properly?

Jan 22, 2012

When I stop my TCP Listener by the Stop command, I always get an error because I use BeginAcceptTcpClient to accept the clients. How can I stop a listener properly?

View 1 Replies

Threading Clients Using A Tcp Listener?

Dec 2, 2009

(Using vb 2008 express.)

I am trying to create a server to send clients text on request. I am using a tcp listener to accept clients then send each client to a thread in a threadpool which deals with each client's request then closes the client connection. It seems to work fine but I would like to know how it works. Using the listen loop below I cant help feeling I should be sending some values to the threaded sub. How does it know which client each thread is dealing with?

Sub ListenLoop()
Looop:
Client = Server.AcceptTcpClient

[Code].....

View 1 Replies

Use Tcpclient And Listener To Use A No-ip Host?

Apr 27, 2009

is there a way to use my tcpclient and listener to use a no-ip host because i am on a laptop

View 5 Replies

Chat Server / Listener Program

Dec 16, 2010

I am trying to write a program that has a server/listener program and then 2 client programs, the 2 client programs are supposed to be able to chat with each other. Can anyone point me in the right direction on this?

View 4 Replies

SMTP Listener Corrupting HTML?

Jan 30, 2009

I have an SMTP listener that accepts incoming connections and routes the message to a folder using FileStream. I have to add x-sender: email@address.com and x-receiver: email@address.com to the first two lines of the file so it can be put in a pickup folder for relay later. It seems as though this way of handling the incoming stream is corrupting the HTML in the email message body. Does anyone have a clue what I am doing wrong or a suggestion that would point me in the right direction regarding what I am missing?

View 7 Replies

Using HTTP Listener To Parse URL Parameters?

Jul 7, 2011

I intend to write a .NET application that does logging and analytics to data using VS 2010. I want to link my application with an external non .NET application via intranet. This external application provides integration through URL triggers. When an event occurs it can send this event parameters to any application via HTTP/HTTPS POST or GET requests. It allows me to select the event parameters to be included in the HTTP request that will be sent as URL parameters. URL parameters consist of a name and a value, and are separated from the URL with a question mark (?).

So an example request can look like this: [URL] any dynamic elements in the URL are displayed in brackets (<>), and are replaced by the corresponding event used at run time.

Now what design method should I follow to create a component in my application to listen to the URL request and parse it's elements. Knowing that I want to protect my URL listener with a username and password.

View 1 Replies

Vb2008 Creating A Port Listener?

Oct 9, 2009

I am using vb2008. I am creating a port listener. When I test the listener I get an exception in the code as shown below.I send one record through ("Hello") . When it tries to read again I get the error. This read would result in EOF. When this happens, shouldn't i go to 0? Instead it keeps its previous value of 5 which is the number of characters in "Hello"

m_blnStop = False
Dim server As TcpListener
server = Nothing
Try

[code]....

View 1 Replies

VS 2008 TCP Listener - Only Responds To 1st Message?

Apr 8, 2009

OK this is my third thread on TCP problems and the first two I managed to figure out for myself within 10 mins of posting before anyone had a chance to reply so lets see if it works again - failing that if you have any advice I'd be most grateful.

I have a server app which should be sitting and listening for messages on one port (4000) and then processing requests and sending data back via another TCP client on a different port (4001). My code is based on someone else's example and it works fine sending and receiving the first message, however after the first message the listener seems to stop listening and never gets any further messages.

Am I misunderstanding how they work? After I get the first message do I need to close the listener and create a new one, or should the same listener keep working until I close it?

[Code]...

View 7 Replies

TCP Send String - No Example Of A Client With A Tcp Listener Built In?

Dec 23, 2011

I create a small program witch is a tcp client.I sent a asqii string to a tcp device over ethernet thads acts like a server.As soon as the device recieves the input string it will respond back with response data. The problem is i am not getting any response data back from the divice. The lenght of the string is max. 30 characters.When a use WireShark i see the reponse, but VB read nothing.I have read many threads with explenations about server/client connections but no example of a client with a tcp listener built in.I think thad the stream read is to late after the send instruction.

View 2 Replies

How To Make Infinite Loop

Jul 12, 2009

1) Diff b/w nothing & string in terms of variable declaration.

2)Erase keyword.I have never heard of such keyword in mine whole 1 + yrs of exp.

3) Diff b/w functions & properties? I say,Functions return a value,But propertiesare used to set or get the values. He say properties also return a value.

4)How can we use a class as a datasource?

5)Partial Class? hey frnds above question is for C++ na.Or there is also such class in VB.Net.

6)When the error stack overflow comes?

7) How we can we make indefinite loop , without uusing any variable declaration.

View 4 Replies

Infinite Loop - TCP Freezing With .NET?

Aug 12, 2009

I made a game in VB .Net that uses tcp and sends messages back and forth.What is happening is, every so often, the message cannot be sent quickly enough, so then the TCPObj.connect() method goes into a loop, until it reaches the timeout and then spits out an error. Most of the time though, it never gets to the error, my application just freezes, and then comes back after TCPObj.connect() succeeds. How can I make the connect() method do application.doevents while it's trying to connect? Basically, I dont want it to freeze up my whole application. Since tcp.connect() is a .NET method, I can't go in and add application.doevents.

View 3 Replies

Write An Infinite For Loop?

Feb 24, 2009

Is it possible to write an infinite for loop in VB.NET?

View 3 Replies

Possible To Create A TCP Listener That Does Not Need A Specific Number Of Connections Initialized?

Jan 30, 2009

I am totally new to socket connections, so I've pieced together code from the internet to try and start a TCP Listener object. [code] Is it possible to create a TCP listener that does not need a specific number of connections initialized? Can I just have it listen on an open port until data is received? I will be receiving a lot of data at once from many servers...

View 1 Replies

Infinite Loop And Cross Threading?

Jun 22, 2011

I am a student attempting to learn VB.NET on my own. Today I wanted to tackle the BackgroundWorker component. I found an excellent article online: How To Use a Background Worker. I successfully completed the walkthrough and even performed the "adventorous" part that dealt with working with controls updating across threads using delegates.Now I came to a part that I didn't understand how it was working. To summarize the following code, I have a delegate that has a Label and a String in its signature. I then have a subroutine that is called on the worker thread. Inside this subroutine the delegate is created and (I guess) ran again so that it is on the same (Main) thread. Please correct me if I'm wrong here.

Here is the method is performed on the worker thread:
Private Sub My_BgWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles My_BGWorker.DoWork

[code].....

View 1 Replies

ListBox Error Infinite Loop With Try

Nov 29, 2008

Code:
p = -1
Try
ListBox3.SelectedIndex = p
Catch ex As Exception
ListBox3.SelectedIndex = -1
p = ListBox3.SelectedIndex
End Try
Just cycles through my listbox without exiting the try. It keeps having an error causing the catch again.

View 1 Replies

VS 2008 - How To Run Infinite Loop In Background

Dec 30, 2010

I am making a program thats going to be an msn style popup for reminders. I made an infinite loop to activate the popup when the date = current date. However its stuck in the loop and I cant run other functions while the loop is running. How can I get the alert to go off while also running the program?

Public Class Form1
Structure List
Dim Name As String
Dim Day As Date
Dim Hour As String
Dim Min As String
[Code] .....

View 4 Replies

VS 2008 AfterUpdate Without The Infinite Loop

Feb 11, 2011

While building out an interface for patient/client lookup, we have a pull from out FoxPro EMR creating the patient table and populating the lookup on the EU interface.

[Code]...

View 2 Replies

VS 2008 How To Round Infinite Number

May 26, 2010

I am trying to round a number but I keep getting an Infinity number. How do I round this.

4000 / 7135 * 100 Here's the code I've tried.

Round(readVals(0) / Scaling1 * 100 + ActualValueLow1, 2)

FormatNumber(readVals(0) / Scaling1 * 100 + ActualValueLow1, 2)

View 12 Replies

Infinite Loop When Json Serializing A Collection

Sep 1, 2010

I am trying to use a Web Service to return Json for a Collection of Users from a Database Table. I'm only new to .NET (< 1 week experience), and I don't want to use the UpdatePanel for AJAX. I have tried using the JavaScriptSerializer as well as Json.NET to serialize. Both cases seem to spawn an Infinite Loop.[code]

View 1 Replies

Bubble Sort Gets Stuck In An Infinite Loop

Apr 22, 2012

I'm bubble sorting an array called number which starts at (1) and ends with (6), the code I'm currently using is this:[code]

View 2 Replies







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