LinePrinter.Open (string, int) Method
Opens the communications connection between the mobile computer and the printer. Use this method if the Port Type specified in the configuration file is WIFI or SOCKET.
Syntax
[Visual Basic]
Public Function Open(
portString As string,
newPort as int
) As void
[C#]
public void Open(
string portString,
int newPort
);
Parameters
portString
If the Port Type specified in the configuration file is WIFI, this value replaces ADDRESS in the configuration file.
If the Port Type specified in the configuration file is SOCKET, this value can be any of the following:
- "IRDA" - Use for IRDA connections to the first discovered IRDA device using default parameters.
- "IRDA:IRServiceName", where IRServiceName replaces the IRServiceName parameter in the configuration file. For most printers, use LSAP-SEL002 or IrDA:IrCOMM.
- An IP4 format, such as "192.68.1.100". Use this to connect to a Wi-Fi printer with the specified IP address. This value replaces ADDRESS in the configuration file if ADDRESS is specified.
- A Bluetooth address format, such as "00:02:5b:00:02:58". Use this to connect to a Bluetooth printer with the specified Bluetooth address. This value replaces ADDRESS in the configuration file if ADDRESS is specified.
newPort
If the Port Type specified in the configuration file is WIFI, this value replaces IPPORT as specified in the configuration file. Many Wi-Fi printers use either port 515 or 9100 by default.
If the Port Type specified in the configuration file is SOCKET, this value can be any of the following:
- When portString is "IRDA" or "IRDA:IRServiceName", newPort replaces the IRModelRLMP parameter in the configuration file. For most printers, use 21 or 22.
- When portString is an IP4 format, newPort replaces IPPORT as specified in the configuration file.
- When portString is a Bluetooth address format, newPort replaces BTPIN as specified in the configuration file.
Return Values
Void.
Remarks
Actions taken during Open include:
- Establish contact with printer.
- Send initialization sequence to printer.
- Reset font types to normal.
The portString and newPort parameters replace the network address and port specified in the configuration file, allowing easier programmatic determination of the network printer target. This method may be used only for Wi-Fi communications.
Exceptions
LinePrinterException
More Information
LinePrinter Class