I need to read asynchronous data from Telnet connection I telnet library provides a handler and so I set it this way I:
public PortechGSMBox (string Aipadres, Int port, string user, string password, Int Modulnm = 1) {telnet = new Telnetvepr (); Telnet.Data available + new dataAvailableApplicationHandler (Dataraisevandler); Telnet Disconnected = new disconnected event handler (disconnected handler); Telnet Connect (ipadres, ports); Login (user, password, modulation); } Private vain Dataraisewahandlr (object Srkol, Dataawvavik event Aarjijh) {output + = Aljdeta} I noticed that the figures may be, may be not in the right order that this event many People comes from thread So if the server sends "123456789" then I might get "56781234". I tried to add [MethodImpl (MethodImplOptions.Synchronized)] before DataHandler, but did not work. What do you suggest?
When sending numeric values What happens then? If you have to change the HostToNetwork Order and NetworkHost order, these methods are present in the IPADress class. Get
// Do IPAddress.NetworkToHostOrder (BitConverter.ToInt32 (bytearray, 0)); // When IPAddress.HostToNetworkOrder (ID) or If you are byte / byte, it will only help you, it will not work if you are sending a string .
No comments:
Post a Comment