i've been having this problem and its kiiling me! i'm a newbie at this so i hope someone would be able to help me.
picture link: http://i98.photobucket.com/albums/l2...plication2.jpg
this pops up whenever i click on the Disconnect button after i have connected.
these are the following codes for the program.
Expand|Select|Wrap|Line Numbers
- Imports SN = System.Net
- Imports SNS = System.Net.Sockets
- Imports ST = System.Text
- Imports System.Net
- Public Class _Default
- Dim tcpClient As New System.Net.Sockets.TcpClient
- Dim connectport As String
- Sub dc(ByVal tcpclient As SNS.TcpClient)
- Dim NetworkStream As SNS.NetworkStream = tcpclient.GetStream
- tcpclient.Client.Close()
- NetworkStream.Close()
- msg("Disconnected from port:" + connectport)
- status("IP:" + "Disconnected" + vbCrLf + "Port:" + "Disconnected")
- End Sub
- Private Sub dcBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dcBtn.Click
- Try
- dc(tcpClient)
- Catch ex As Exception
- msg("Socket Exception is : " & ex.Message)
- End Try
- End Sub
- End Class
- Partial Class _Default
- Inherits System.Web.UI.Page
- Sub msg(ByVal message As String)
- Msgbox.Text = Msgbox.Text + message + vbCrLf
- End Sub
- Sub status(ByVal message As String)
- statusbox.Text = message + vbCrLf
- End Sub
- Sub outputconnect(ByVal tcpclient As SNS.TcpClient)
- 'Input IP Address and TCP port
- Dim address As String
- Dim port As String
- address = ipbox.Text
- port = portbox.Text
- connectport = portbox.Text
- If tcpclient.Connected = False Then
- tcpclient.Connect(address, port)
- msg("Connected to IP:" + address + " via port:" + port)
- status("IP:" + address + vbCrLf + "Port:" + port)
- End If
- End Sub
- Private Sub connectBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles connectBtn.Click
- tcpClient = New System.Net.Sockets.TcpClient
- Try
- outputconnect(tcpClient)
- Catch ex As Exception
- msg("Socket Exception is : " & ex.Message)
- End Try
- End Sub
- End Class
I hope someone would be able to help me, i would really appreciate it!
Keith.