Printer and Computer Net work

For issues with communication ports, protocols, etc.
niels olsen
Posts: 27
Joined: May 28, 2006 18:32
Location: denmark

Printer and Computer Net work

Postby niels olsen » Oct 09, 2016 8:27

I am working on programme for a client. He has to use the programme for selecting electrical gear motor out from specifications. The programme contains data for around 2000 motors. For each motor there are 12 spefications.
There has no problems in making the programme, and it works fine on a stand-alone computer.
For printing the stand-alone computer the programme has to have:
OPEN "LPT1:" FOR OUTPUT AS #1
PRIN #1, . . .
.
.
PRINT CHR$(13): CLOSE #1: END
But what do write when the computer is a net work computer? The programme has only to work on one of his computers.
The printer is a HP Laser Jet Pro MFP M127fn.
The IP-adress is: 10.0.0.196, and port is 9100 raw.

I am looking foward seeing something smart, thanking you
am remain yours sincerely
Niels Olsen

PS: I wrote similar message a few days ago, but when using "Save Draft" it was deleted!
MrSwiss
Posts: 2682
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Printer and Computer Net work

Postby MrSwiss » Oct 09, 2016 9:02

niels olsen wrote:But what do write when the computer is a net work computer?
The programme has only to work on one of his computers. (this is not relevant)
The printer is a HP Laser Jet Pro MFP M127fn.
The IP-adress is: 10.0.0.196, and port is 9100 raw.

For this to work, you'll have to use (include) a Network-Library into the program.
See the section titled "Libraries" ...

niels olsen wrote:PS: I wrote similar message a few days ago, but when using "Save Draft" it was deleted!

No, its probably still there, but only "inside" your "user profile". Log yourself "in" and check it out.
To commit (your article) to the Forum, you'll have to press the "Submit"-button !!!
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: Printer and Computer Net work

Postby D.J.Peters » Oct 09, 2016 17:17

[S]imple [N]etwork [C]onnection

Code: Select all

#include once "snc.bi"
' test of a printer client connection
const as string ServerIP   = "10.0.0.196"
const as ushort ServerPort = 9100
' connect to printer server
var client = NetworkClient(ServerIP,ServerPort)
' get a connection from ConnectionFactory
var connection = client.GetConnection()
' ready to send ?
while connection->CanPut()<>1: sleep 100 : wend
' put data on the connection
connection->PutData(@yourData,SizeOfYourData)
sleep

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest