Reading one line from a text file

MoTT
06-08-2003, 01:05 PM
I've made a simple messaging program for 60 or so computers at school. It uses the winsock control and sends scheduled alerts out. Sometimes it is neccessary to send global messages.

I have the list of IP address in a .txt. Here is the first few lines:

192.168.99.2
192.168.99.3
192.168.99.4
192.168.99.5
192.168.99.6
192.168.99.7

Is it possible to read the first line, set winsock1.remoteip as the first line, send the message, then move onto the next line? In effect sending a message to each IP address

I know I could create more winsock controls, but like I said, there are about 60 computers.

I'm not sure if this is in the right section, sorry if it isn't!

anomaly
06-08-2003, 01:49 PM
all you have to do is set the socket state to sckClosed and then connect to the new ip then send the message, then close it again...ect.

MoTT
06-09-2003, 10:54 AM
all you have to do is set the socket state to sckClosed and then connect to the new ip then send the message, then close it again...ect.

yes, but how do I read the IP from the file?

Squirm
06-09-2003, 02:20 PM
Dim ff As Integer
Dim theIP As String

Open theFilename For Input As #ff
Line Input #ff, theIP
Close #ff

MsgBox theIP

angula
06-09-2003, 02:25 PM
How about this:

Dim IPAddress as String
Dim IPAddressFile as String

IPAddressFile = "c:\ip.txt"

Open for Input IPAddressFile as #1
While Not EOF(1) Do
Line Input #1, IPAddress
Set winsock1.remoteip = IPAddress 'or whatever the call should be
Loop
Close #1

-----------------
I think that will work.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum