Results 1 to 6 of 6

Thread: How to recieve UDP packet as client

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2017
    Posts
    8

    How to recieve UDP packet as client

    Well, I'm making a bot for multiplayer game. Game works on both protocol - TCP and UDP. I did the TCP part, but I'm having problems with UDP now. I know I don't need to connect Winsock cuz UDP protocol is conectionless, but how do I do this then?
    So, considering my app is client, how will it receive UDP packets from server if it does not connect?
    More precisely, I need my app to send back every UDP packet it receives. This is what I tried, but I guess there's something wrong with this, cuz it does not receive any packet.

    Code:
    Private Sub Command2_Click()
    Winsock3.RemoteHost = Text2.Text
    Winsock3.RemotePort = Text3.Text
    End Sub
    Code:
    Private Sub Winsock3_DataArrival(ByVal bytesTotal As Long)
    Dim UDPPacket() As Byte
    Winsock3.GetData UDPPacket
    Winsock3.SendData UDPPacket
    End Sub

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2017
    Posts
    8

    Re: How to recieve UDP packet as client

    This is duplicate post... I clicked the button to post before I finished, by accident. I don't know how to delete this now -.-

  3. #3
    Junior Member Fimpass's Avatar
    Join Date
    Feb 2017
    Location
    Romania
    Posts
    17

    Re: How to recieve UDP packet as client

    Listen:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    
        Sock.LocalPort = 10101
        Sock.Protocol = sckUDPProtocol
        Sock.Bind
    End Sub
    
    Private Sub Sock_DataArrival(ByVal bytesTotal As Long)
    Dim Data As String
    
        Sock.GetData Data
        MsgBox Data
    End Sub
    Send Data:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    
        Sock.RemoteHost = "127.0.0.1"
        Sock.RemotePort = 10101
        Sock.Protocol = sckUDPProtocol
        Sock.SendData "Boo!"
    End Sub

  4. #4
    Junior Member Fimpass's Avatar
    Join Date
    Feb 2017
    Location
    Romania
    Posts
    17

    Re: How to recieve UDP packet as client


  5. #5
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: How to recieve UDP packet as client

    Well, I'm making a bot for multiplayer game
    Our terms of service expressly prohibit questions on how to violate any third parties terms of service. Unless the third party game in question allows the use of bots then this is not a topic we would want discussed.

    Which game is this for?
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,908

    Re: How to recieve UDP packet as client

    Quote Originally Posted by MadLover68 View Post
    Hello, will you help me?
    A package I caught with Wpe pro
    I want to add a project
    Start your own thread.
    The is second post in an existing thread with a complete different subject.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width