Supply a connection IP address or com port and the correct
IConnection concrete class will be created and returned
Example
IConnection c1 = Connection.Create("192.168.0.5"); // returns a TCPConnection class
IConnection c2 = Connection.Create("COM6", 9600); //returns a SerialConnection class with the baud rate set to 9600
Namespace: Brainboxes.IOAssembly: Brainboxes.IO (in Brainboxes.IO.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static IConnection Create(
string ipAddressOrComPort,
int portOrBaudRate = 0,
int timeout = 2000
)
Public Shared Function Create (
ipAddressOrComPort As String,
Optional portOrBaudRate As Integer = 0,
Optional timeout As Integer = 2000
) As IConnection
static member Create :
ipAddressOrComPort : string *
?portOrBaudRate : int *
?timeout : int
(* Defaults:
let _portOrBaudRate = defaultArg portOrBaudRate 0
let _timeout = defaultArg timeout 2000
*)
-> IConnection
Parameters
- ipAddressOrComPort String
- either an IP address e.g. "192.168.0.1" or a com port name e.g. "COM3"
- portOrBaudRate Int32 (Optional)
- optional either the IP port number e.g. 9500 or the com port baud rate e.g. 115200
- timeout Int32 (Optional)
- optional the read write timeout for the connection defaults to 2,000ms
Return Value
IConnection[Missing <returns> documentation for "M:Brainboxes.IO.Connection.Create(System.String,System.Int32,System.Int32)"]
See Also