' Look at ' http://www.pstnet.com/support/kb.asp?TopicID=2528 Dim MySocket As SocketDevice Set MySocket = New SocketDevice MySocket.Name = "MySocket" Dim theSocketDeviceInfo As SocketDeviceInfo ' can also be a DNS name of x.x.x.x IP address theSocketDeviceInfo.Server = "127.0.0.1" theSocketDeviceInfo.Port = 2016 theSocketDeviceInfo.SocketType = ebSocketTypeTcp theSocketDeviceInfo.ByteOrdering = ebByteOrderingLittleEndian 'Open MySocket.Open theSocketDeviceInfo 'Send Dim arrData(8) As Integer arrData(0) = 3 ' command arrData(1) = 5 ' len of values (low byte) arrData(2) = 0 ' len of values (high byte) arrData(3) = 255 ' byte 0: Connector 1 arrData(4) = 0 ' byte 1: Connector 2 arrData(5) = 0 ' byte 2: Connector 3 arrData(6) = 0 ' byte 3: Connector 4 arrData(7) = 0 ' byte 4: Connector 5 MySocket.WriteBytes arrData ' values of dots (every dot in a cell is a bit in the byte) ' ---------------------------------------------------------------------------- ' byte 0 byte 1 byte 2 byte 3 byte 4 ' connector 1 connector 2 connector 3 connector 4 connector 5 ' ---------------------------------------------------------------------------- ' 1 oo 8 1 oo 8 1 oo 8 1 oo 8 1 oo 8 ' 2 oo 16 2 oo 16 2 oo 16 2 oo 16 2 oo 16 ' 4 oo 32 4 oo 32 4 oo 32 4 oo 32 4 oo 32 ' 64 oo 128 64 oo 128 64 oo 128 64 oo 128 64 oo 128 ' ---------------------------------------------------------------------------- ' 0 = all pins down, 255 = all pins set ' 1+2+4+64 = set left pins ' 8+16+32+128 = set right pins ' Read Key (optional) MySocket.ReadBytes... Key down Byte 0 is the command (22) Byte 1 is the low byte of the following length of bytes (1) Byte 2 is the high byte of the following length of bytes (0) Byte 3 is the key code (0,1,2,3,4) Key up Byte 0 is the command (23) Byte 1 is the low byte of the following length of bytes (1) Byte 2 is the high byte of the following length of bytes (0) Byte 3 is the key code (0,1,2,3,4) ' Flush and close MySocket.FlushInputBuffer MySocket.FlushOutputBuffer Sleep 500 MySocket.Close Set MySocket = Nothing