[AccessD] Printing to a network port

Stuart McLachlan stuart at lexacorp.com.pg
Fri Dec 11 16:05:29 CST 2009


Another way - write your own little DLL or shell application in PowerBasic - it's very easy and 
now it's cheap to!!!

PowerBasic have just put out a great deal.  PB/WIn is currently Version 9.  They are selling 
Version 8 under the name "Classic PowerBasic"  for USD49.

Go to http://www.powerbasic.com/

As an example, here's the total code needed to send a string of data and get a response 
from one of my programs.

        TCP OPEN PORT nPort AT sServer AS nSocket TIMEOUT 5000
        IF ERR THEN
            sPacket =  "Cannot connect to Listener Server at " & sServer & " on Port " _
                              & STR$(nPort)& " - Err: " & STR$(ERR)
        ELSE
            TCP PRINT nSocket, strMessage;
            ERRCLEAR
            DO
              TCP RECV nSocket, 1024, sBuffer
               sPacket = sPacket + sBuffer
            LOOP UNTIL   sBuffer = "" OR ISTRUE EOF(nSocket) OR ISTRUE ERR
            IF sBuffer = "" OR ERR THEN 
               sPacket = "No reply from the server! -" & STR$(ERR)
            END IF
        END IF
        TCP CLOSE nSocket


Adding a few more lines  would make this the total source for a  compilable single function 
DLL. ( which would end up as a DLL about 5KB in size)
 
The DLL would be a "proper" DLL, so no need to register it - just DECLARE the function in 
your VBA and call it like any other function.

-- 
Stuart
 

On 12 Dec 2009 at 7:31, Stuart McLachlan wrote:

> Shell "Ping 192.168.1.1"   
> is about the simplest way I know to send data directly to a network address from Access.
> <g>
> 
> Oh, you meant useful data to a port which can be used at the other end?  You will need to 
> do some Winsock programming.
> 
> If you are happy to use third party components, the "free for personal use" OSWINSCK is 
> easy to use.  Instructions for use with Access including sample code are at
> http://www.ostrosoft.com/oswinsck/oswinsck_vba.asp
> 
> -- 
> Stuart
> 
> On 11 Dec 2009 at 11:54, Dale Kalsow wrote:
> 
> > 
> > Does anyone have any good examples how of to send data directly to a
> > network ip address?  It would be a local ip address (if that makes any
> > difference).   thanks!   Dale 
> > 
> > 
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 






More information about the AccessD mailing list