IDK MSD-54 Series Command Guide User Manual
Page 7

MSD-54 Series Users Guide (Command Guide)
7
Note:
If any command is not sent from the computer side to the MSD for 30 seconds, it disconnects the
connection to avoid the limitation problem on the number of connections. As a result, connection needs
to be established again from the computer side after the current connection of the computer is
disconnected. (As the number of ports in the MDS-54 series is eight, if the computer is turned off while
it is connected, ports are occupied permanently. To prevent this, the connection is disconnected if no
communication command is sent from the computer side.)
Example of programing with Microsoft Visual Basic.NET 2008:
Acquiring the following three data using Button1_Click in line 105 and sending the communication command
to the MSD:
- “communication command to be sent” of TextBox1
- “target host” of TextBox2
- “port number” of TextBox3
In this example, the following programing is run to solve the data transmission delay occurred when
connection and close are performed repeatedly. This is correspondent to the lines 4, 5, 14, 15, 16 in the
programing example.
TcpClient.NoDelay: This disables the delay if send or receive buffer does not exceed the set size. The
specified value is “False”. The delay time can be reduced by changing the NoDelay
property.
'Open the cliant
Private stClient As TcpClient
'client class
Private stns As System.Net.Sockets.NetworkStream 'Stream
class
Private portNum As Integer
'Port number
Private hostName As String
'Host name
stClient = New System.Net.Sockets.TcpClient(hostName, portNum)
stClient.NoDelay = True
'Disable delay
stns = stClient.GetStream()
'Open stream