Click here to Skip to main content
15,883,819 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
while i am trying to execute the following code there is nothing in task bar. I mean, there is no executing form. :( Please help me with this.

VB
Imports System.Net.Sockets
Imports System.Text
Public Class Form1
    Public Shared serverSocket As New TcpListener(System.Net.IPAddress.Any, 8888)
    Public Shared requestCount As Integer
    Public Shared clientSocket As TcpClient
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        serverSocket.Start()
        TextBox1.AppendText("Started..")
        clientSocket = serverSocket.AcceptTcpClient()
        TextBox1.AppendText("Accept connection from client..")
        requestCount = 0
        While (clientSocket.Connected = True)
            Try
                requestCount = requestCount + 1
                Dim networkStream As NetworkStream = clientSocket.GetStream()
                Dim bytesFrom(10024) As Byte
                networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
                Dim dataFromClient As String = System.Text.Encoding.ASCII.GetString(bytesFrom)
                dataFromClient = dataFromClient.Substring(0, dataFromClient.IndexOf("$"))
                TextBox1.AppendText(dataFromClient)
                Dim serverResponse As String = "Server response " + Convert.ToString(requestCount)
                Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(serverResponse)
                networkStream.Write(sendBytes, 0, sendBytes.Length)
                networkStream.Flush()
                TextBox1.AppendText("serverResponse")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        End While
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       
    End Sub
End Class
Posted
Updated 30-May-13 21:33pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900