Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is There An Easier Way To Do This 1

Status
Not open for further replies.

yacyac

Programmer
Jul 29, 2002
78
US
I have two computers (A and B) that are connected together through an ethernet connection, and they can see each other.

Users on computer B select items they would like to purchase. The user changes constantly (it is a touch screen in a mall). The program on computer A sees what the users on computer B have selected (once they select 'Send').

Here is how I am doing this. Computer A and B have a networked mapped directory they share. When the users on computer B click 'Send' their selections are sent to a common file on the mapped directory. This file is created each morning and appended whenever a user on computer B selects 'Send'. I have a timer on computer A that at set intervals looks to see if the last modified time of the common file has changed. If it has, it is opened and read. The results are display on computer A.

I have thought of having each user of computer B send the data to a separate time stamped file and have computer A search for new files. This would eliminate computer A trying to read the file while computer B is trying to write to it.

What I would like to do is have computer B dump the data into a listbox in the program computer A is running without having to deal with files. Is that possible? If so, can some one lead me in the right direction? I have tried searching for this and have come up with nothing - thanks

 
I believe the 'winsock' control would work well for this.

I found this tutorial with a basic Google search that should help you to determine if this will work for your application:


I've written some local network apps using winsock with success. If you need further assistance, let me know. :)

I hope it helps,
Harold

***You can't change your past, but you can change your future***
 
re your <<This would eliminate computer A trying to read the file while computer B is trying to write to it.>>

Are you getting error 70s? if not what else?

Please supply the Open statement you are using for the file Write on computer B and the one your are using for file Read on computer A.

regards Hugh,
 
Could be your situation is more complicated and/ or you have already tried this but this (monitor) app seems to work for me.

Option Explicit
DefInt A-Z
Dim f

Private Sub Command1_Click()
Dim mystr As String * 10
Get #f, LOF(f) / 768, mystr
Print mystr; " file length "; LOF(f)
End Sub

Private Sub Form_Load()
f = FreeFile
Open "MyDataFile" For Random Access Read Shared As f Len = 768
'tested reading an opening and closing file opened with
'Open "MyDataFile" For Random Lock Write As DFnum Len = 768

End Sub

Private Sub Form_Unload(Cancel As Integer)
Close f
End Sub

regards Hugh,
 
There's an obscure command [wink]

[!]DefInt A-Z[/!]



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
hmmmmm..... :)

***You can't change your past, but you can change your future***
 
George,

An oldie but goodie. Specifies that all unqualified variables in the module will be integers eg. f in the example.Can be a boon if you go off Integers and want to convert them all to Longs in a flash.

There are a whole family of similar ones including DefLng, DefDbl etc.

Otherwise all the unqualified variables are Variants.

regards Hugh
 
I know what it does. But it is rare.

It's like watching a '57 Chevy drive down the road. It's rare, so you look. You may even feel compelled to point at it and remark to friends, "Hey... Did you see that? Cool huh?"

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Harold
That was exactly what i was looking for thanks - heres a star
 
Thanks yacyac! I'm glad it's working for you. :)

***You can't change your past, but you can change your future***
 
Personally, I wouldn't use DefInt, etc., Hugh's idea about changing Integers to Longs notwithstanding. My feeling is that the code overhead time saved is more than canceled out by risk of increased maintenance overhead. A matter of style, perhaps.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top