sketchucation logo sketchucation
    • Login
    1. Home
    2. sungamer
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    Posts

    Recent Best Controversial
    • UDP Socket and Threading in API

      Hey,

      I'm trying to integrate a new self developed input device into SU. The device is connected over RS232 and data is processed through an C# application.
      Now I tried to send the data over UDP to SU. This is my Ruby Plugin code for testing:

      require 'socket'
      
      server = Thread.new {
      	$port = 3157
      	$maxSize = 100
      	serverSocket = UDPSocket.new
      	serverSocket.bind("127.0.0.1", $port)
      
      	UI.messagebox("Socket open!")
      
      	loop {
      		data = serverSocket.recvfrom($maxSize)
      		if data.length != 0
      			UI.messagebox(data)
      		end
      	}
      
      }
      

      If I send a UDP message to this socket, i don't get a message from SU but Windows shows me, that the socket is open.
      Could anybody tell me why this is not working? Thank you!

      Greetings,
      Patrick

      posted in Developers' Forum
      S
      sungamer
    • 1 / 1