TCP disconnect
TCP disconnect
TCP disconnect
TCP disconnect
TCP disconnect
TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect
TCP disconnect TCP disconnect
TCP disconnect
Go Back  Xtreme Visual Basic Talk > > > TCP disconnect


Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2011, 08:15 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default TCP disconnect


Hey all,

I'm probably not understanding how this works but I've got two machines connected successfully and the connection is open. I call the Close method on one end. The connection appears to stay up on the other client. Should the other side disconnect automatically and detect that the connection has gone down or do I have to signal an intention to disconnect somehow?

Thanks,
Reply With Quote
  #2  
Old 05-13-2011, 09:05 AM
AtmaWeapon's Avatar
AtmaWeaponTCP disconnect AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

What's your code look like? I'm curious if you close the stream as well or just the connection.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 05-13-2011, 09:17 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

Thanks for the reply. I suspect that's where I'm going wrong since I'm quite new to TCP .NET programming.

It's nothing special, I'm just using mClient.Client.Disconnect(False) where mClient is my TCP Client.
Reply With Quote
  #4  
Old 05-13-2011, 12:38 PM
AtmaWeapon's Avatar
AtmaWeaponTCP disconnect AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Try closing the stream before closing the connection. In general, if something has a Close() method you should call it as soon as possible. Note how in the example both the stream and the client are closed.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #5  
Old 05-18-2011, 03:49 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

Mmm, thanks for that. I'm not using the GetStream method which I think is the issue. Using the Close method on the TCPClient disposes it completely and the remote endpoint still doesn't disconnect itself. I will change my code so I can use the Stream properties and see if I have more luck.
Reply With Quote
  #6  
Old 05-18-2011, 08:15 AM
AtmaWeapon's Avatar
AtmaWeaponTCP disconnect AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

What on Earth were you doing with it if you weren't using the stream? That's the only way to send and receive data with that class.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #7  
Old 05-18-2011, 08:41 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

Yes, but I wasn't using that class. I was using the Send method with the TCPClient class. E.g.

Dim T As New TCPClient("server",10000)
T.Client.Send etc...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
TCP disconnect
TCP disconnect
TCP disconnect TCP disconnect
TCP disconnect
TCP disconnect
TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect TCP disconnect
TCP disconnect
TCP disconnect
 
TCP disconnect
TCP disconnect
 
-->