[AccessD] Printing to a network port

jwcolby jwcolby at colbyconsulting.com
Fri Dec 11 16:58:56 CST 2009


Or go with a REAL programming language like C#.

<ducks and runs>

John W. Colby
www.ColbyConsulting.com


Stuart McLachlan wrote:
> 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.
> 



More information about the AccessD mailing list