Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Quick Way To Check If A Winsock Connection Is Open?


first off, im using a control array of winsock controls. they are all listening on the same port.

now, the problem is, whena new person logs on, a new isntance of the control i created. this is fine, untill 5000 logins later your server is out of ram. i need an effective way of unloading the winsock controls after they lose their connection.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Quick Winsock Connection Question.
I have set up a program which acts as a server on a computer on my LAN. Basically the server just listens on port 8000.

So when I connect the client to the server for the first time everything works perfect. But if i close the socket using Winsock.Close then try and reconnect I get an error msg saying that the socket is in use. So do I have to also close the socket on the server for the socket to be totally closed? Or am I looking at the big picture the wrong way?

Winsock Tcp Connection Check
Hello everybody.
I have written in VB6 a server-client chat-like application based on the winsock component.
I establsh a TCP connection to each client using an array of Winsock controls.
Every time a user connects to the server, it sends to every connected user the updated list of the connected clients.
The only thing i can't figure out is how to check whether my clients are still connected (if somebody shuts down the applicatio properly there's no problem since the client sends a packet telling the server it is shutting down, but if the application freezes or the computer is resetted this doesn't work, obviously). Is there anyway I can check if the other host is "still there"?
Thanks in advance
NeT

VB6 - Winsock - Check Connection
Hello:

I have a VB6 client/server app using Winsock features and am having some problems with it.

On the client side, I have a series of commands like the following:

If Winsock1.State = sckConnected Then
Winsock1.SendData ("Ad1Break")
TotalSent = TotalSent + 1
Label2.Caption = "Total Script Commands Sent to Server: " & TotalSent
End If
End Sub

However, after the client has been running for a long period (anywhere between 30 and 1 1/2 hours) without sending any commands to the server, even though it reports its status as CONNECTED, it does not successfully transmit the command to the server.

Is there any other way to test the connection before sending over the command to ensure that the connection is still active and the server is listening and will receive the command.

Connection is made in the following script:

If ConnectToServer1 = 1 Then
If Winsock1.State <> sckClosed And _
Winsock1.State <> sckConnected Then
Winsock1.Close
End If
If Winsock1.State = sckClosed Then
Winsock1.Connect
End If
'Report connection status
If Winsock1.State = sckConnected Then
Label1.Caption = "Connected to " & EncoderHost1 & ":" & EncoderPort1
Else
Label1.Caption = "Attempting to connect to Script Command Server: " _
& EncoderHost1 & ":" & EncoderPort1
End If
Else
Label1.Caption = "Not connected to Script Command Server: Running in stand-alone mode"
End If

Thanks so much for your help.

David

Winsock Check Connection Problem
i'm using vb6

i'm doing a chat program and i have made two project, "Host" and "Client".

The "Host" can connect and disconnect from the "Client" under normal condition.
But when the computer, which have the "Client" program, power trip, the "Host" is still detect as connected.
When the computer resume, the "Client" cannot connect back.

I would like to ask, how to check a connection ? Then if the connection is lose, close the winsock. Just like the computer power tirp, the other party closes the winsock.

Below is the code i tried but is still detect as connected, even one party is gone.
Code:Private Sub Timer1_Timer()
Dim index As Integer
If Winsock1(index).State <> sckConnected Then
Me.Caption = "Not Connected"
Winsock1(index).Close
Winsock1(index).Listen
Else
Me.Caption = "Connected"
End If
End Sub

Thanks for helping me.

Check If Connection Is Open
I people,
How can I check if my connection is open....???

I already tried :

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=DesenvolvimentoRh Vb v.1.0compactador.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Mode = adModeReadWrite
con.Open


if con.open = true then


BLABLABLABLA.....

How To Check The Connection Open
Hello,
How can i check that the database connection is open or not.
if connection is open, then how to close ?

i m using ADO 2.1 library

Check If Connection Is Open
i wonder if anyone can help.

i have a form where someone can search the database to see if a username already exists, before creating a new account. when it has searched and the recordset is still connected, the Clear button will close the recordset connection (rs.close). however, if i click Clear without having it open, i get an error. my question is, if it is possible, how do i make an IF statement to check to see if the recordset is currently open, and thuse closing in, or if it is close, then take no action?

How Can I Change The Timeout Check For TCP_IP Winsock Control As The Connection Is Disconnected?
Hi! Everybody!
I want to know how i can change the timeout check for the TCPIP winsock control as the connection is disconnected. Now i find when i connect two computers through TCPIP and if the connection is disconnected, one computer know the connection is cut at least 60seconds later and another cannot know the connection cut. I want to change the timeout to a smaller value. How can i achieve this?
Thank you very much!

Winsock Problem, Error 10053, Not When Connecting, But While Connection Is Open.
Hi guys.
I have searched the site, and couldn't find something that answers my question, so here goes.
I have an application, chat, client side made with adobe flash (former macromedia flash), server side in VB6, using good 'ol winsock, the programmer nightmare...
everything works just fine, only every once in a while, not all the time but often enough to make my boss question my ability as a VB programmer, which I am not, but what ever..., an error will register in my application, error number 10053, with description "Connection is aborted due to timeout or other failure".
What can cause this? the error shows up at non regular intervals, some times when a user was connected for a few seconds, some time after an hour or more of continuous connection...
Any ideas how can this be solved/avoided?

Thanks.

Let me know if you want to see specific parts of my code, and I will post it here.

Yuval Lahav.

How To Check Connection To DB Is Connected And How To Check Record Set Really Have Result?
Code:Set DB = New ADODB.Connection
DB.ConnectionString = "Provider=" & DB_PROVIDER & ";" & _
           "Network Library=DBMSSOCN;" & _
           "Data Source=" & strSQLServer & _
           "; Initial Catalog = " & strDatabaseName & _
           "; User ID = " & strUserID & _
           "; Password = " & strPassWord
DB.Open
debug.print DB.state


Question : How can I check is the DB connection really connected (active)?
i use DB.state
and the result show 1
is it ok, if not please give suggestion?

Code:
sSQL = "Select * from table1"
  Set RS = New ADODB.Recordset
  RS.ActiveConnection = DB
  RS.Source = sSQL
  RS.Open

debug.print rs.recordCount


Question : I want to know how many record were find from the query. When I use debug.print rs.recordCount, it show -1. is it mean there is no record found? Should I use rs.properties.count instead?

I am confussing how to get record set and why there is no result from the query... something wrong?

Winsock State 8 - Peer Closes The Connection Leaving Winsock High And Dry
I am debugging some web/proxy-serving code. I am stumped.

I get Winsock state 8 - Peer is closing the connection
Then Winsock error message wrong protocol or connection state.

It seems to me that Winsock closes before it can finish sending all of its data.

How can I keep Winsock in state 7 - Connected?


Thanks...

Really Quick Check Box Question
Ok, just wondering if you can disable user input of a check box without greying it out.

Thanks

Quick Check On My Angles...
i've read around alot and noticed that nearly every time the Atn() function is used in determining angles, 0 degrees points to the right. well several months ago, using stale and fading knowledge of trig, i created an angle calulation function. my angle calculation seems to return angles with zero pointing down. why is that?

here is my code:


Code:
Public Const pi As Double = 3.14159265358979
Public Const toRadian As Double = (pi / 180)
Public Const toDegree As Double = (180 / pi)

Public Function AngleCalc(ByRef X1 As Single, ByRef Y1 As Single, ByRef X2 As Single, ByRef Y2 As Single) As Single
Dim opp As Single, adj As Single, Rad As Single

opp = (X1 - X2)
adj = (Y1 - Y2)

If adj = 0 Then
If X2 < X1 Then
Rad = 270 * toRadian
ElseIf X2 > X1 Then
Rad = 90 * toRadian
End If
Else
Rad = Atn(opp / adj)
End If

'this is a simple way of solving the prob of Atn() only functioning
'correctly if x was negative; it just adds 180 degrees
If Y2 < Y1 Then Rad = Rad + (180 * toRadian)

'this 'fixes' a problem of the radians being negative after 270 degrees
'i've never figured out why this problem even occurs
If Rad < 0 Then Rad = Rad + (360 * toRadian)

'converts the radian value to degrees
AngleCalc = Rad * toDegree
End Function

i got the code to draw lines at an angle from a friend, but i've seen it with cos & sin switched several times, so i'm not sure wich is correct. this is what he gave me:


Code:
X = (Sin(Angle * toRadian) * LineLength) + LocationX
Y = (Cos(Angle * toRadian) * LineLength) + LocationY

this draws lines with zero pointing to the right as well.
what's up with my code?

What Is A Very Quick Way To Check If One Image Is Like Another?
For example, i have 1000 gifs on my hd, and i want to compare a new gif to the 1000, and return which of the 1000 my gif is most like.

anyone know what the quickest method would be? i dont mean filesize or anything, i mean whats IN the image itself (ie pixel by pixel)

Should I Have 100s Of Winsock Connections Open/close.. Or Keep Them Open (hard Q)?
Hello
Ive got a server to which many clients connect to.

They each are given a few tasks to complete - which may or may not take a long time to finish, and after each task is done they send back the result.

This has caused massive amounts of problems for me. Right now I keep the connections open all the time. My server listens on one particular winsock control on a particular port to which all clients connect. It then accepts the connection request thru a second array of winsocks, so each client is connected to the server via the array via one connection.

There is generally no problem sending out the tasks thru that single connection/client - but receiving is a problem. The client may need to send back a few hundred kb at a time but since it was completing several tasks at once - it is not always received correctly. My guess is because taskA is sending data thru the connection at the same time as taskB - and the data isnt received right (each task sends its data via a <start> and an <end> string so I know where the start/end of data is and when transmission is over). Its important to note that the tasks are multithreaded (via a 3rd party control)

The data is sent in one line per task. winsock.SendData theResult. But many tasks can complete at around the same time. I thought that VB would wait until the data was completely sent (for one lines code) before moving on... but I dont think this is happening. I even tried adding a DoEvents but to no avail - I still cant receive the data properly. Maybe winsock is 'skipping over' some data - I dont know. (Kinda like when if you 'break' the application winsock does not get incoming data and when you resume it still wont pick it up)

So Ive got 2 options..
1) Somehow figure out how to receive data properly when multiple tasks finish on a client at around the same time and they send data at the same time - basically making the program send the data of a task and not continue until the data has been sent, then send another tasks data.

2) Use many connections. Basically the max # of tasks running at once will be about 10. So the idea is to have another winsock array of 10, each dedicated to one task, and when a task is completed - connect thru the winsock array, send the data, and when the server receives it - it disconnects.

3) A mixture of 1 and 2 - have the 10 winsocks connect to the server and be open at the same time, then I can just send data and receive via a specific winsock array control and there is no problem distinguishing taskA from taskB from taskC on a client, or client from client.

But honestly.. I dont know if its 'bad' to have lots of connections open and close all the time. And I dont know if its 'bad' to have thousands of connections open at the same time either..

What do you guys think?

Quick DB Connection Question (RESOLVED)
If you are using VB to connect to a Pervasive Database, is the code somewhat the same as if you were connceting to Access, Oracle... etc?



Edited by - epatterson78 on 6/3/2003 7:39:02 AM

Open...whats Open? Record Connection?
I have some code and it keeps dying on the line:

objRSTC.ActiveConnection = Nothing

The complete code is long:


VB Code:
Private Sub CopyTransports(lngProposalID As Long)On Error GoTo Err_Handler Dim objCmd As ADODB.CommandDim objRS As ADODB.Recordset  'for transportsDim objRSTC As ADODB.Recordset 'for transport componentsDim lngOldTransportID As LongDim lngNewTransportID As Long Call EstablishConnectionSet objCmd = New ADODB.CommandobjConn.CursorLocation = adUseClient 'first we snatch current proposal's transports'the one we are looking at...    With objCmd        .ActiveConnection = objConn        .CommandText = "select_transports_by_proposal"      'our stored procedure is good_login        .CommandType = adCmdStoredProc         'its a stored procedure        .Parameters.Append .CreateParameter("ProposalID", adInteger, adParamInput, , lngProposalID)        Set objRS = .Execute        objRS.ActiveConnection = Nothing        Call ReleaseConnection    End With        If objRS.BOF Then        'no records?        Exit Sub    Else        If objRS.EOF Then            Exit Sub        Else            Call EstablishConnection            While Not objRS.EOF                 'we loop through each transport                Set objCmd = Nothing                Set objCmd = New ADODB.Command                                'grab the old transportid                lngOldTransportID = objRS("TransportID").Value                                'create the new transport                With objCmd                    .ActiveConnection = objConn                    .CommandText = "insert_transport"       'our stored procedure is good_login                    .CommandType = adCmdStoredProc         'its a stored procedure                    .Parameters.Append .CreateParameter("TransportID", adInteger, adParamReturnValue)                    .Parameters.Append .CreateParameter("ProposalID", adBigInt, adParamInput, , NewProposalID)     'transport will get newest proposal id that was just created                    .Parameters.Append .CreateParameter("TDescription", adLongVarChar, adParamInput, SizeOfSQLText, objRS("TDescription").Value)                    .Parameters.Append .CreateParameter("TFunction", adLongVarChar, adParamInput, SizeOfSQLText, objRS("TFunction").Value)                    .Parameters.Append .CreateParameter("TAssumption", adLongVarChar, adParamInput, SizeOfSQLText, objRS("TAssumption").Value)                    .Parameters.Append .CreateParameter("TEndPos", adSmallInt, adParamInput, , objRS("TEndPos").Value)                    .Parameters.Append .CreateParameter("CreatedBy", adVarChar, adParamInput, 30, objRS("CreatedBy").Value)                    .Parameters.Append .CreateParameter("CreatedOn", adDate, adParamInput, , objRS("CreatedOn").Value)                    .Execute                    'grab the new transport id                    lngNewTransportID = .Parameters("TransportID").Value  'whats the TransportID?                End With                                'now we have to do this components transports...that is we                'first search for oldtransportid's components                'if they are found they are inserted for the                'newtransportid's component                                    'so first we find oldtransportid's components                    Set objCmd = Nothing                    Set objCmd = New ADODB.Command                                        With objCmd                        .ActiveConnection = objConn                        .CommandText = "select_transport_components_by_transport_id"      'our stored procedure is good_login                        .CommandType = adCmdStoredProc         'its a stored procedure                        .Parameters.Append .CreateParameter("TransportID", adBigInt, adParamInput, , lngOldTransportID)                        Set objRSTC = .Execute                        objRSTC.ActiveConnection = Nothing                        Call ReleaseConnection                    End With                                        'we have found the old transportid's components                    'so now we have to add the transport components to the newest transportid                        If objRSTC.BOF Then                            'no records                        Else                            Call EstablishConnection                                While Not objRSTC.EOF                                    Set objCmd = Nothing                                    Set objCmd = New ADODB.Command                                    With objCmd                                        .ActiveConnection = objConn                                        .CommandText = "insert_transport_component"                                        .CommandType = adCmdStoredProc         'its a stored procedure                                        .Parameters.Append .CreateParameter("TCompID", adInteger, adParamReturnValue)                                        .Parameters.Append .CreateParameter("TransportID", adBigInt, adParamInput, , lngNewTransportID)                                        .Parameters.Append .CreateParameter("AdditionalDescription", adLongVarChar, adParamInput, SizeOfSQLText, objRSTC("AdditionalDescription").Value)                                        'TComp holds the TXXX number                                        .Parameters.Append .CreateParameter("TComp", adVarChar, adParamInput, IIf(Len(objRSTC("TComponent").Value) < 1, 50, Len(objRSTC("TComponent").Value)), objRSTC("TComponent").Value)                                        .Parameters.Append .CreateParameter("TCompDescription", adVarChar, adParamInput, IIf(Len(objRSTC("TComponentDescription").Value) < 1, 1000, Len(objRSTC("TComponentDescription").Value)), objRSTC("TComponentDescription").Value)                                        .Parameters.Append .CreateParameter("Quantity", adInteger, adParamInput, , objRSTC("Quantity").Value)                                        .Parameters.Append .CreateParameter("N", adInteger, adParamInput, , objRSTC("N").Value)                                        .Parameters.Append .CreateParameter("TCPos", adInteger, adParamInput, , objRSTC("TCPos").Value)                                        .Parameters.Append .CreateParameter("CreatedBy", adVarChar, adParamInput, 30, objRSTC("CreatedBy").Value)                                        .Parameters.Append .CreateParameter("CreatedOn", adDate, adParamInput, , objRSTC("CreatedOn").Value)                                        .Execute                                    End With                                                                        objRSTC.MoveNext                                Wend                        End If        'end if objRSTC.bof then                    objRS.MoveNext            Wend        End If    End If Done:Set objCmd = NothingSet objRS = NothingSet objRSTC = NothingExit Sub Err_Handler:MsgBox Err.Description, vbCritical, "Error #: " & Err.NumberResume Done End Sub


Pay close attention to where its happening though:


VB Code:
'so first we find oldtransportid's components                    Set objCmd = Nothing                    Set objCmd = New ADODB.Command                                        With objCmd                        .ActiveConnection = objConn                        .CommandText = "select_transport_components_by_transport_id"      'our stored procedure is good_login                        .CommandType = adCmdStoredProc         'its a stored procedure                        .Parameters.Append .CreateParameter("TransportID", adBigInt, adParamInput, , lngOldTransportID)                        Set objRSTC = .Execute                        objRSTC.ActiveConnection = Nothing                        Call ReleaseConnection                    End With


The error is:

[error]
Operation is not allowed when the object is open?
[error]

Not sure why?

Jon

Quick Winsock Help
when recieving data i use vbString, is there one for images, or even, does anyone else have any others there are?

Quick Way To Check Value Of A Listview Subitem ?
I have a ListView with nine columns. I would like to check one of the columns (subitems) to see if it has the value "Good". If it does then it should be removed from the ListView. Here's the code I'm currently working with:

...

If ListView1.ListItems.Item(im_2).ListSubItems.Item(im_2).Text = "Good" Then

ListView1.ListItems.Remove (im_2)

Else

MsgBox ("else ran")

End If

...

Thanks for any help.

- Jake

Quick String Check For / : * ? &" &lt; &gt; |
I remember seeing something before to really quickly check for, or remove these characters ( / : * ? " < > | ) from a string.

I think it was something like a Replace, but it was different.

Quick Winsock Question.
I have a mutliple user chat room type thing.

im using a winsock array (one for each user)

Sometimes users will request something from the server, how do I send it to just that user.

Right now the only way I can send data is to the first guy on the user list or everyone (doing a loop).

Quick Winsock Question, Please L@@k
In the Connection_Request event that is fired when a client tries to connect to a server, my book has this code:


Code:
winsock1.Close
winsock1.Accept strRequestID


I dont understand, because if you close the connection, then accept the request, how is the communication done?? Hope this makes sense. Could someone pls explain to me how the code above works, or give me a quick overview on how a client and a server talk to each other. Thanks

Quick Winsock Question
Hi

I have developed a winsock application.

Everything is working fine except for client disconnections.


If a client program is closed, the Winsock Close event occurs on the server program.

However, if windows crashes, or the client computer is just turned off, the close event does not occur. How can I get it to occur?

Also, what is a good way of checking if a connection exists, even if the close event hasn't happened?

My program uses a control array so that multiple clients can connect at the same time.


Thanks.

Quick Winsock Question
I am writing client and server applications using Winsock.

My client app will "connect" to the server's IP even though the Server isn't "Listening"

How can the client check to see if the Server is listening

Thanks


John

Easiest And Quick Way To Check If Files Are Identical?
What would be the easiest way to check if two files are identical. Mind you, this for server / client checks. basicly the server sends some code of the file and something about the file (lets say file size), and then client will check to see if it is the same or not, and if it is different, it will download it. But this ain't about getting the file sent over.

Simple put, what would be the best way to detect if a file is different. I have been trying modified dates, but many installers change the modified date depending on timezone from what I've seen, Ive also had one change it by simply seconds!

I've done file size before, but I've seen filesize sometimes doesn't 'change fully' if the change is something minor, (Like a couple things done in a image.)

I've hear of hash checks spitting out a 16 number code or something like that, but I've not been able to find it anywhere, google isn't my friend today.

Thanks!

What Is A Quick Way To Check For Empty Text Boxes?
I have a few text boxes that I would like to validate. It would be an uter mess if I use if/else/elseif statements. I thought maybe using select case or maybe using the boolean statment (if possible)

any suggestions?

Quick Question - How Can I Check If Something Exists In A String??
How can i check if ".exe" is in a string?? For example, if i had,

My$ = "app.exe"
If (Check if My$ contains .exe) then
msgbox ".exe was found in the string"
else
msgbox "*.exe was not found in the string"
end if


anyone know how to replace (Check if My$ contains .exe) with vbcode?? I think its InStr(string).. but im not sure

Quick Winsock Sendfile Question
hi, how can i send files through winsock, i mean applications, not just strings or text from the vb program, but outside programs.


Also, howcan I show the progress in a progressbar?

appreciae any help, thanks!

A Quick Question On Winsock Arrays
A quick question on winsock arrays.

As the minute i have a winsock array that, allows lot's of clients to send data to the winsock array then when data is received it saves to a database, using a scripting engine "CallbyName" i can get the client to request data from the database and put it into two text boxs on the server program.

My question is how do i send the data in the text boxs to only the client that requested it?

Thanks.

Very Quick Question - How Can I Check If Something Exists In A String? (InStr)
If I did this:

mystring = "Thewordyesisengravedinhere"

How can i make an if statement that sends a messagebox if the word "yes" is in a string?

I tried

Code:
mystring = "thewordyesisengravedinhere"
If InStr("yes", mystring) Then
MsgBox "Yes was found"
Else
MsgBox "Yes was not found"
End If

but it doesnt work.. anyone know?

Winsock Connection Prob: &"Request To Connection Time Out&".
Hi All,

I am developing chat application like Yahoo and MSN messenger. Also i have almost completed it. I have two applications one is server appliation which will be run on chat server machine. the other is client appliation which will be used at any corner of the world.

Its working fine on my network. Ya, it is also working fine over network but with some misbehaviour. Sometimesm, it allow someone to login and sometimes it doesn't and gives "Request to connection time out" error.. I can't find the reason y it is happening.

I have developed this in visual basic and used winsock control.

Winsock Connection Prob: &"Attempt To Connection Time Out&".
Hi All,

I am developing chat application like Yahoo and MSN messenger. Also i have almost completed it. I have two applications one is server appliation which will be run on chat server machine. the other is client appliation which will be used at any corner of the world.

Its working fine on my network. Ya, it is also working fine over network but with some misbehaviour. Sometimesm, it allow someone to login and sometimes it doesn't and gives "Attempt to connection time out" error.. I can't find the reason y it is happening.

I have developed this in visual basic and used winsock control. Any idea regarding this may help me out.

Crystal Report Version 4.6 Connection Problem. Quick Help Needed!
Anybody!!

I'm using Crystal 4.6 that comes with VB 6.0.
When I make a report in the Crystal desginer, it saves the data once and after that I'm tring to show that report from my VB application - but report data remains the same all the time. Even if I change database content! (I'm using Access MDB) - it seems like Crystal saves the data in the report and doesn't update it on PrintReport action.
So I've tried to connect to the RPT file from VB, but it says "login error...". I've tried that LogonServer function. Ir doesn't work!

So, help needed! And quick as possible!

Thanks in advance.
Bob

Quick Open Question
Ok this reads line 1 on a text file

Open "c:yourfile.txt" For Input As #1
Dim sFirst
Line Input #1, sFirst
If sFirst = "yes" Then
Label1.Visible = True
Else
Exit Sub
End If

Close #1

y when i switch line input#1 to 2 it doesnt read line 2? How would i go about change it to line 2.

Valid EMail Address (Well Just A Quick Check To See If It Has Common Errors?)
Hmm,

Error:
I get a type missmatch with:


VB Code:
If Not (InStr(Me.txtFromEMail, "@", ".")) Then GoTo InvalidEMail:


and with :


VB Code:
If Not (InStr(Me.txtFromEMail.text, "@" )) OR NOT (InStr(Me.txtFromEMail.text".")) Then GoTo InvalidEMail:


It wont accept it as a valid email at all.

Any idea/

Winsock Data Parsing Problem....Quick!!!
All,

i have a Winsock control receiving data from my controller. The data received is comma seperated numbers in the form of a string.

I need to split the numbers up so that they can be printed to the screen seperately.....heres what i have...

tcpclient.getdata data, vbstring,bytestotal
splitdata = split(data, ",")
for i = lbound(splitdata) to ubound(splitdata)
text.caption = splitdata(i)
next

the code works but its taking up all the processor time. It looks like splitdata just keeps getting bigger and bigger, is there anyway to reset it when it gets to say 8? If i could do that i could do other things on the program and the program would only branch off when it sees data arrived as opposed to getting stuck in a loop.

Matt

Check If Workbook Is Open And If Not Open It
Hello

I need to open and use a workbook that may already be open. How do I write code that will check whether the workbook is already open?

Thanks

BlinkingNora

Check To See If Workbook Is Open, If Not, Open..?
I have a VB Function that uses another workbook to check for data comparison. If that workbook is not open when I run the macro then it kills the entire sub and I have to then open the workbook and start again.

Is there a way for it to check if Workbook is open, if yes then contiue, if not then open the workbook and continue?

Check If Outlook Is Open - If Not, Open It
How can I check if MS Outlook is open and if it's not - open it?

Open A Text File [quick]
If a text file, of any length, had no enter charaters, the whole file would be loaded with a simple 'Input #FileNum, strString' command, right?

Check Connection
Does anyone know if there is any way I can use VB to determine if the user has a connection to the web.

I want to run a code that retrieves external data from a web site, but it would will only run if there is a connection present, if not it will display a msgbox stating that they need to connect??

How To Check For Net Connection?
Whats the quickest and easiest way to check for a Internet Connection? I want it to return True or False, that simple.

Of course, I dont mean LAN, but Internet. If its a private IP (like 169.x.x.x) then I want it to be FALSE as well. You get the picture

Check For Connection
Scenario:
FE database on laptop that has linked tables to the server.  AutoExec macro initiates the links.  My problem is that if not connected to the server the db fails because it cannot find the links.

1.  How can it check for a proper link prior to running the AutoExec macros?

2.  If a connection IS NOT found then ignore linking the tables.

3.  If a connection IS found then continue with the links.

Thanks for any help.

Check If Connection Is Used
I wanna check if the connection is already made.


Global QcDb as new ADOdb.Connection
Global QcRs as new ADOdb.Recordset
...
QcDb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & dbstring & ";"



THNX

[i]Wimel
Axxes
Belgium

Check Connection
Do anyone know how to write a VB code to check who is connected to our share driver. A code that can do similar task as Netwatcher. Appreciate any reply.

How To Check Dial-up Connection?
I have made an application which connects to another (remote) computer using DialUp Connection (aon application side) and Incomming Connection on remote computer side.
I want to check every 10 seconds if this connection still exists or not (using timer to raise control procedure). I'm using some code I have downloaded previously ....

*******************************************************
Public Function ActiveConnection() As Boolean

'function checks registry for
'an active connection

Dim hKey As Long
Dim lpData As Long
Dim nSizeData As Long
Const sSubKey = "SystemCurrentControlSetServicesRemoteAccess"
Const sKeyValue = "Remote Connection"
If RegOpenKey(HKEY_LOCAL_MACHINE, _
sSubKey, _
hKey) = ERROR_SUCCESS Then
lpData = 0&
nSizeData = Len(lpData)
If RegQueryValueEx(hKey, _
sKeyValue, _
0&, _
0&, _
lpData, _
nSizeData) = ERROR_SUCCESS Then
ActiveConnection = lpData <> 0
End If
Call RegCloseKey(hKey)
End If
End Function
**********************************************************
As I'm using Windows 2000 Pro ... I think that something is wrong with Registry keys because this function above returns False although connection exists (System Tray indication) or ... hm, as it is not connection to Internet but to remote computer directly I wander if it is related to this problem.

Thanks

Check Network Connection
How could one do a simple check to see if a network connection is active? What references and components (if any) do I need?

Thank you!

Check Internet Connection
Hello,

I have an API call that tells me whether or not I have an internet connection which works if I pass it a valid http: address.

I cannot get it to work when I pass it an IP address instead. Is there any other way I can check for this without having to introduce the INET control on my form? Any help will be appreciated.


Code:
Private Const FLAG_ICC_FORCE_CONNECTION = &H1
Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long

Private Sub Form_Load()
' This works
If InternetCheckConnection("http://www.msn.com", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "Connection to http://www.msn.com failed!", vbInformation
Else
MsgBox "Connection to http://www.msn.com succeeded!", vbInformation
End If

' This DOESN'T work
If InternetCheckConnection("192.169.2.40", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "Connection to 192.169.2.40 failed!", vbInformation
Else
MsgBox "Connection to 192.169.2.40 succeeded!", vbInformation
End If
End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved