:| Fuck you LOOP!

Posts 1–8 of 8 · Page 1 of 1
:| Fuck you LOOP!
Code:
Imports System.Net
Imports System.Net.Sockets
Imports System.IO

Public Class FriendInvoke

    Private lis As New TcpListener(10030)

    Public ReadOnly Property RequestedBytes As Byte()
        Get
            Dim req As HttpWebRequest = WebRequest.Create("http://whatismyip.com/automation/n09230945.asp")
            Dim res As HttpWebResponse = req.GetResponse()
            Dim Stream As Stream = res.GetResponseStream()
            Dim sr As StreamReader = New StreamReader(Stream)
            Dim xp As String = (sr.ReadToEnd) & " | ComeIn"
            Dim b() As Byte = Text.ASCIIEncoding.ASCII.GetBytes(xp)
            Return b
        End Get
    End Property

    Public Sub SendReq(ByVal ip As String)
        Dim x As New TcpClient(ip, 10030)
        Dim sr As Stream = x.GetStream()
        sr.Write(RequestedBytes, 0, RequestedBytes.Length)
    End Sub

    Dim x As New mes()

    Public Sub sRun()
        lis.AllowNatTraversal(True)
        While (True)
            lis.Start()
            Dim s As Socket = lis.AcceptSocket()
            Dim c As TcpClient = lis.AcceptTcpClient()
            Dim sr As Stream = c.GetStream()
            Dim rB(100) As Byte
            sr.Read(rB, 0, rB.Length)
            Dim str As String = Text.ASCIIEncoding.ASCII.GetString(rB)
            If str.Contains(" | ComeIn") Then
                Dim ip As String = str.Replace(" | ComeIn", "")
                x.Label1.Text = x.Label1.Text.Replace("%%%", ip)
                x.Show()
                If x.Accepted = 1 Then
                    Process.Start("aiw://connect " & ip)
                Else
                    s.Disconnect(False)
                    c.Close()
                End If
            End If
        End While
    End Sub

    Public Sub Run()
        Dim a As New Threading.Thread(AddressOf sRun)
        a.Start()
    End Sub

End Class
It's simple, I just want a app that when gets a buffer that contains the text " | ComeIn", it will popup a window, and if they user clicks on a label of the window a game will start otherwise not. Well the window do appear but I can't click anywhere -.-
My brain is fucked up right now cuz I studied all the day for the exams so I can't figure it out good, please halp!

IDK but I'm pretty sure it has to do with the while shit at the top -.-
What's need to reveice " | ComeIn" ??
Quote Originally Posted by hustelboy View Post
What's need to reveice " | ComeIn" ??
Yes, anyways now per now I got it working with a message box, but the user can't select if he wants to join the party or not.
Post solution here, the point of these help threads is also to potentially avoid repetition of the same question by offering the answer in the thread.
Code:
x.Label1.Text = x.Label1.Text.Replace("%%%", ip)
                x.Show()
                If x.Accepted = 1 Then
                    Process.Start("aiw://connect " & ip)
                Else
                    s.Disconnect(False)
                    c.Close()
                End If
Make that part:
Code:
Dim shitfuck As MsgBoxResult = MsgBox(ip, YesNo, "Party Invite")
  if shitfuck = Yes then Process.start("aiw://connect/" &ip)
But It won't work on remote machines, I've tried it 3 times.
Like I can't send the request to a remote machine, and they can't send me a request, even if we forward the TCP Listener port (10030)
System.Net.Sockets doesn't contain a UDP Listener Class. Also UDP doesn't support file transfert (Yes I want to implement that too) , UDP is for Voice, Audio, etc. So yea I think that TCP Is OK, well maybe the prob is on my pc?
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us