\**fScan Reference Manual, Chapter 2 (CmdLineOptions): connect**
===== Connect -- Open a network or external communication port connection=====
==== usage: ====
-connect mode name [flag] hostport timeout\\
-connect READ name [flag] storevarb [maxchars timeout]\\
-connect WRITE name [flag] data [nchars]\\
-connect QUERY name querystr [flag] replydata [timeout maxchars]\\
-connect CLOSE name\\
-connect POLL name\\
-connect NOPOLL name\\
MODE:\\
* SOCKET - network port (default mode)
* SERVER - network connection for fScan image server/client
* CLIENT - network connection for fScan image server/client
* DBAX - network connection to DBAX database server
* COM - serial port
FLAG:\\
* Opening
* 1 - open for reading\\
* 2 - open for writing\\
* 4 - listening port; wait for client to connect
* Writing
* 0 - default
* 1,2 - write data variable DATA
* Reading
* 1 - expect single return value
* 2 - expect table (list) to br read
Note: fScan server connects with flag=7; fScan client with flag=3.
If you attempt to WRITE or QUERY a connection, that has not yet been opened, CONNECT will
look for the HOSTPORT specification in a user variable called "connect_CNXNNAME" (where CNXNNAME is the name of the connection). If found, CONNECT will attempt an auto-connection to that network location before attempting the WRITE/QUERY. This is equivalent to inserting the command:\\
-connect name $connect_name
For example, if you routinely connect to a DBAX database server, you could define 'connect_dbax' in your [[jvs:fscan:manual:chapter1:configfile|CONFIG]] file as:
sagan.dhe.duke.edu:5570
Then you could communicate with that server by simply using commands like:
-connect dbax query "select subjid,exam,sex,age from exams" 2 examtable
**See Also:**\\
[[jvs:fscan|fScan Home]],
[[jvs:fscan:manual|fScan Manual]],
[[jvs:fscan:manual:chapter2|CmdLineOptions]],
[[jvs:fscan:manual:help|Manual Help]]