sending a simple TABLE in between hosts
EDITED:
hello!
i'm a newbie to the forum and to VB as well. i'd like to send a simple table in between hosts/clients but am cluless as to where to start. i've been learning a little about ADO controls but so far i haven't encountered anything on sending the actual table in between machines. can someone enlighten me on this? i'd really appreciate any help i could get.
thanks!
alcyone
Re: sending simple databases in between hosts
Hi alcyone, welcome to VBForums! :wave:
One thing that concerns me, is why are you trying to send the database between machines? You can connect to a database which is stored on another computer (most DBMS's are designed specifically for this, and the others allow it).
Re: sending simple databases in between hosts
well, thing is, i'm trying to do a program which simulates how the RIP routing protocol sends its updates (i.e. a router sending its whole routing table to its neighbors) using only pcs acting as routers. the updates are simple tables of network info which gets swapped in between hosts on regular intervals. i thought the best way to do that is simply to send the database as it is (just like how a real router does it). i hope you, or anyone, could suggest an easier way of doing it than i imagined.
thanks again!
Re: sending simple databases in between hosts
Are you thinking that the network connections between the different computers are likely to stop? (or want to be safe in case they do)
If so, then copying the database to each machine makes sense.. otherwise I would recommend just connecting to a single database - which can be done by (basically) just changing the connection settings of the data control.
..or does each machine have its own unique data, in addition to the shared data?
Re: sending simple databases in between hosts
yes, each machine have its own unique data, some info get added or deleted as new destinations are learned and known ones go down. each database would be really simple table and just contain a few records. what's the simplest way to go about doing this?
thanks!
Re: sending simple databases in between hosts
I don't have much experience in actually transfering data between machines, but am aware that Winsock is probably the way to go. I can't help with code for it, but our Networking FAQ can probably help.
In terms of what to send (and how to put it back together at the other end), we need to know a bit more info..
In what format is the database? (is it a text file/access database/...?).
What is the design of the table? (field names & data types)
Is the data to be kept 'long term', or just while the program is running?
Re: sending simple databases in between hosts
In what format is the database? (is it a text file/access database/...?)
> access database
What is the design of the table? (field names & data types)
sample of basic contents of the database:
Network Mask Next hop
192.168.1.0 255.255.255.0 via 192.168.2.1
192.168.2.0 255.255.255.0 via E0
>it's really a simple table with just a few records in it, not really a big database
Is the data to be kept 'long term', or just while the program is running?
i was thinking long term but either way is actually fine.
where do i start?
thanks!
Re: sending simple databases in between hosts
i might have used the wrong words in my previous post. let's get the terminology right first. the updates are simple tables of network info which gets swapped in between hosts on regular intervals. the router is sending a TABLE. it's not sending an entire database. what needs to be sent to the other routers is ONE table with the changed routing information in it. the receiving router has to evaluate what's sent to it to see if anything has changed, update its table if there are changes and just ignore the update if there aren't. i hope this clarifies what i'm trying to do.
anyone got any ideas? ;)
Re: sending a simple TABLE in between hosts
I am doing something similar. What you want to do is to iterate though all the records in the table and add each field of the record to a string. As you add each field, (and start of each record) you have to separate them by a delimiter (eg "|" for fields, "^" for records ).
When you reach eof, send the string to your client and do the reverse, updating your table.
Re: sending a simple TABLE in between hosts
Ok, in that case I would say add the records to the table - using an "Insert" SQL statement or the .AddNew method of a recordset.
I agree with dlern, send the records as a delimited string - just make sure that the delimiters you use aren't ever going to be part of the data (the ones dlern suggested may be appropriate for you).
I would recommend giving each record an ID too, so that you can tell if the data being received is already in your table - so that you don't add it again.