How to connect Socket with Websocket?

0

Maybe the title is a bit silly, but I will explain, I have a Socket Server that I made in VB and I also have a Client Socket made in Javascript for web, only problem is that the Client (Web) understands that the established connection is the server needs to return 101, otherwise:

Itstaysin"Pending" until it disconnects, I still do not know how to get the server to return this, could anyone explain how to do it?

It was already a bit annoying to develop the server in Visual Basic because the examples I found on the internet were very simple, my code also rsrs

Imports System.Net.Sockets
Imports System.IO
Imports System.Threading
Imports System.Net

Module Principal
    Dim ServerIP As IPAddress = IPAddress.Parse("192.168.0.3")
    Dim Server As New TcpListener(ServerIP, 80)
    Dim Client As New TcpClient
    Dim Reader As StreamReader
    Dim Writer As StreamWriter

    Sub Main()
        Server.Start()
        Client = Server.AcceptTcpClient
        Dim Thread As New Thread(AddressOf Receive)
        Thread.Start()
        While Client.Connected
            Dim m = Console.ReadLine
            If Len(m) Then
                Writer = New StreamWriter(Client.GetStream)
                Writer.WriteLine(m)
                Writer.Flush()
            End If
        End While
    End Sub
    Sub Receive()
        While Client.Connected
            Reader = New StreamReader(Client.GetStream)
            Dim Received = Reader.ReadLine
            If Len(Received) Then
                Console.WriteLine(Received)
            End If
        End While
        Main()
    End Sub


End Module

Well, if anyone could help, I would appreciate it.

    
asked by anonymous 27.09.2016 / 23:23

0 answers