Dart Home | PowerTCP Sockets for .NET | Custom Development | Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
Author | Forum: PowerTCP Sockets for .NET (Secure and Standard) Topic: convert from version 1.1 to 4.4 |
khalednet85 From: ---, USA Posts: 2 Member Since: 02/09/13 |
posted February 9, 2013 1:05 AM hi, I had powertcp version 1.1, I decided to upgrade, so I purchased version 4.4, now I got a lot of errors, syntax errors, everywhere of the project, please help to know how the objects changed from 1.1 to 4.4, here are some errors which I got in my project: private void udp1_EndReceive(object sender, Dart.PowerTCP.Sockets.DatagramEventArgs e) { string msg = e.Datagram.ToString(); LEAMRALogger.Logger.WriteByDate("Logs", "INFO", "udp1_EndReceive", "udp1_EndReceive Function: " + msg); tcp1.Connect("127.0.0.1", TCPPort); tcp1.Send(msg); tcp1.Close(); udp1.BeginReceive(buffer); } private Dart.PowerTCP.Sockets.Tcp tcp1; private Dart.PowerTCP.Sockets.Udp udp1; private Dart.PowerTCP.Sockets.Server server1; private System.Diagnostics.EventLog eventLog1; private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.tcp1 = new Dart.PowerTCP.Sockets.Tcp(this.components); this.udp1 = new Dart.PowerTCP.Sockets.Udp(this.components); this.server1 = new Dart.PowerTCP.Sockets.Server(this.components); this.eventLog1 = new System.Diagnostics.EventLog(); ((System.ComponentModel.ISupportInitialize)(this.eventLog1)).BeginInit(); // // tcp1 // this.tcp1.Charset = "windows-1256"; // // udp1 // this.udp1.Charset = "windows-1256"; this.udp1.Editor = this.udp1; this.udp1.EndReceive += new Dart.PowerTCP.Sockets.Da |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 11, 2013 10:02 AM Hello, The control was redesigned, so I am unable to just provide a 1:1 conversion guide here, but to get you started: tcp1.Connect("127.0.0.1", TCPPort); = tcp1.Connect(new TcpSession(new IPEndPoint("127.0.0.1", TCPPort); tcp1.Send(msg); = tcp1.Write(msg); BeginReceive (and EndReceive) has been removed. Call Udp.Receive on a worker thread: udp1.Start(UdpReceive, null); private void UdpReceive(object state) { byte[] buffer = new byte[1024]; udp1.Receive(buffer); } And use udp1.Marshal (with the Udp UserState event wired up) to transfer data back to the UI thread. Alternatively, use Udp.ReceiveAsync(). Server now creates a new IO completion thread for each new client: Server.Listen(Convert.ToInt32(TCPPort)); = server1.Start(server1_NewConnection, TCPPort, null); private void server1_NewConnection(Tcp tcp, object state) { } (replaces server1_Connection) If you have any further specific questions, please let me know. I would recommend examining our included Server sample for a demonstration of using the server component (and TCP and UDP client samples for demonstrations of their use). |
hcfung68 From: USA Posts: 1 Member Since: 04/11/16 |
posted April 12, 2016 12:21 PM Hi, I have a VB project that is using powertcp version 1.1 and need to convert to version 4.4. I have used BeginReceive and EndReceive to receive data from host. Below is the section of the code: Imports Dart.PowerTcp.Telnet Public Class TelnetComm Implements IComm Private WithEvents mobjTelnet As New Telnet() Public Sub Connect() Implements IComm.Connect mobjTelnet.Connect("127.0.0.1") 'Start receiving data from host mobjTelnet.BeginReceive(mbytInData) End Sub Public Event ReceiveEnd(strMessage As String) Implements IComm.DataReceived Private Sub Telnet_EndReceive(ByVal sender As Object, _ ByVal e As Dart.PowerTCP.Telnet.SegmentEventArgs) _ Handles mobjTelnet.EndReceive If mobjTelnet.Connected = True Then SyncLock (mstrReceivedMessage) mstrReceivedMessage = mstrReceivedMessage.Append(e.Segment.ToString) End SyncLock mobjTelnet.BeginReceive(mbytInData) End If End Class I would need some assistance to convert it to version 4.4. Any assistance would be appreciated. Thanks |
Jamie Powell (Admin) From: Rome, NY USA Posts: 448 Member Since: 03/13/07 Extra Support Options Custom Application Development |
posted April 13, 2016 11:40 AM Thank you for your post. With the release of version 4.x, we've moved to a multithreading-centric design. A multithreaded implementation demonstrating a read loop can be found in our help documentation here: http://www.dart.com/help/pttelnet/Dart.Telnet~Dart.Telnet.Telnet~Start.html |
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |