B4J Question B4J and UDP question

Discussion in 'B4J Questions' started by Jerez, Jul 31, 2015.

  1. Jerez

    Jerez Active Member Licensed User

    Hi, i build an app to connect each to other using UDP protocol sending a message to 255.255.255.255 and 8888 port.

    Also i have a C# Windows Service with similar code that send a response at port 8888 that works great with follow sample code (B4a)

    My questions is, can i do something similiar with B4J and UDP? also use in Raspberry Pi?

    I want to deprecate my C# app and go cross platform... excuse my english

    thanks!

    My B4a code:
    Code:
    Dim Packet As UDPPacket

     
        
    Dim dest As String
        
    Dim data() As Byte
     
        UDPSocket1.Initialize(
    "UDP"88888000)
     
        data = 
    "REQUEST".GetBytes("UTF8")
     
        dest = 
    "255.255.255.255"
     
        Packet.Initialize(data, dest, 
    8888)
     
        UDPSocket1.Send(Packet)
    Code:
    Sub UDP_PacketArrived (Packet As UDPPacket)
     
         
    Dim ResponseMachine As String = "http://" & Packet.HostAddress & ":8083"
    'Here is my server!

    End Sub
    EDIT***

    I'm sorry this question is already answered... obviously... yes we can!

    http://www.b4x.com/android/forum/threads/udp-sample.39886/#content
     
    Last edited: Jul 31, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice