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: Reach Tcp in EventHandler ... |
cuhlig info.mail@uhligweb.de From: Suedbrookmerland, Germany Posts: 25 Member Since: 04/08/04 |
posted April 26, 2004 5:37 AM High, how can i reach the (object sender) and its properties in an event. I´ve an Array of Tcp-Objects which all fire the same Events. Inside i need to know "who am i" as Tcp.Socket. The sender is it, how can i reach it inside the handle. For example sender.connected or sender.send() ... private void AllTcp_ConnectedChanged(object sender, System.EventArgs e) { //Fires when Connection is established or closed if (sender.Connected) {} } |
cuhlig info.mail@uhligweb.de From: Suedbrookmerland, Germany Posts: 25 Member Since: 04/08/04 |
posted April 26, 2004 6:52 AM This throuws a marshal-error. How do i get the Connection inside ConnectedChanged? private void tcp1_ConnectedChanged(object sender, System.EventArgs e) { Dart.PowerTCP.Sockets.Tcp TCPsender = (Dart.PowerTCP.Sockets.Tcp)sender; if (TCPsender.Connected){} } |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted April 26, 2004 8:47 AM Please see the following thread where another customer was doing something similar: http://support.dart.com/postings?topicid=2821 |
cuhlig info.mail@uhligweb.de From: Suedbrookmerland, Germany Posts: 25 Member Since: 04/08/04 |
posted April 26, 2004 9:46 AM In this Thread they use: Private Sub Tcp_ConnectedChanged(ByVal sender As Object, ByVal e As EventArgs) Dim s As Tcp = sender Debug.WriteLine("CONNECTED CHANGED FIRED FOR INDEX " + s.Tag + "!") End Sub I think it is just the same i do in C#, but under Debug the sender is declared as {IOnetCOM.frmKommunikation} (my Form) not as {Dart.PowerTCP.Sockets.Tcp}as in other delegates. |
cuhlig info.mail@uhligweb.de From: Suedbrookmerland, Germany Posts: 25 Member Since: 04/08/04 |
posted April 26, 2004 9:50 AM Now i do somthing stupid but it works: tcps[i] = new Dart.PowerTCP.Sockets.Tcp(this.components); tcps[i].ConnectTimeout = 20000+i; tcps[i].SynchronizingObject = this; tcps[i].EndReceive += new Dart.PowerTCP.Sockets.SegmentEventHandler(this.tcp1_EndReceive); tcps[i].EndConnect += new Dart.PowerTCP.Sockets.ConnectEventHandler(this.tcp1_EndConnect); switch (i) { case 0 : tcps[i].ConnectedChanged += new System.EventHandler(this.tcp0_ConnectedChanged); break; case 1 : tcps[i].ConnectedChanged += new System.EventHandler(this.tcp1_ConnectedChanged); break; case 2 : tcps[i].ConnectedChanged += new System.EventHandler(this.tcp2_ConnectedChanged); break; case 3 : tcps[i].ConnectedChanged += new System.EventHandler(this.tcp3_ConnectedChanged); break; } tcps[i].BeginConnect(cServer,49154); |
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by
![]() |