• Log in or sign up for an account here: https://www.sythe.org/login

[Help] Sockets Problem

Furbster4

Newcomer
Joined
Jun 16, 2008
Sythe Gold
0
Messages
24
Hey its me here,

I'm attempting to create an IRC Client, but its not working properlly yet...

It connects to the server, but it doesn't reply to a ping response, so it doesn't stay connected... i want to know why it doesn't send the ping.

heres the code thats not working
Code:
        Dim tcpClient As New System.Net.Sockets.TcpClient(), lmao As Integer = "0", _
        message As [Byte]()

        tcpClient.Connect("irc.snm.co.nz", 6667)
        Dim networkStream As NetworkStream = tcpClient.GetStream()
        If networkStream.CanWrite And networkStream.CanRead Then
            ' Read the NetworkStream into a byte buffer.
            Do While lmao <> 3
                Dim bytes(tcpClient.ReceiveBufferSize) As Byte
                networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
                ' Output the data received from the host to the console.
                Dim returndata As String = Encoding.ASCII.GetString(bytes)
                addText(returndata)
                lmao = lmao + 1
            Loop
            ' Do a simple write.
            message = Encoding.ASCII.GetBytes("USER Paul 127.0.0.1 irc.snm.co.nz :Paul" & Chr(10))
            networkStream.Write(message, 0, message.Length)
            message = Encoding.ASCII.GetBytes("NICK hello" & Chr(10))
            networkStream.Write(message, 0, message.Length)
            message = Encoding.ASCII.GetBytes("PONG irc.snm.co.nz" & Chr(10))
            networkStream.Write(message, 0, message.Length)
        Else
            If Not networkStream.CanRead Then
                addText("cannot not write data to this stream")
                tcpClient.Close()
            Else
                If Not networkStream.CanWrite Then
                    addText("cannot read data from this stream")
                    tcpClient.Close()
                End If
            End If
        End If

oh and also, how come when i do

Code:
do while tcpClient.Connect = true

actually doesn't work? :P

like, it works, it won't show the form, until it dies, why? :P
 
Runescape Gamblingrunescape gambling
Back
Top