Skip to content

[UDP] How to send UDP messages on Unity and receive UDP messages on Python? Is there an example? The example of the document does not work #25

Discussion options

You must be logged in to vote

Well i think you wish use Unity as UdpServer and Pyhton as UdpClient.

using now:
NOTICE: First test my code without any modifications, after that: you can modify ip or whatever

// unity server
using System;
using Netly;
using Netly.Core;
using UnityEngine;

class NetlyUdp : MonoBehaviour
{
    private readonly UdpServer server = new UdpServer(useConnection: false);
    public string message = "";
    public String ip = "127.0.0.1";
    public int port = 12000;

    private void Start()
    {
        server.OnOpen(() => Debug.Log("UDP Server, started."));

        server.OnClose(() => Debug.Log("UDP Server, disconnected."));

        server.OnError((exception) => Debug.Log($"UDP Server, er…

Replies: 7 comments 21 replies

Comment options

You must be logged in to vote
1 reply
@1101728133
Comment options

Comment options

You must be logged in to vote
1 reply
@alec1o
Comment options

Comment options

You must be logged in to vote
2 replies
@1101728133
Comment options

@1101728133
Comment options

Comment options

You must be logged in to vote
1 reply
@alec1o
Comment options

Comment options

You must be logged in to vote
1 reply
@alec1o
Comment options

Comment options

You must be logged in to vote
12 replies
@1101728133
Comment options

@1101728133
Comment options

@alec1o
Comment options

@alec1o
Comment options

@alec1o
Comment options

Answer selected by alec1o
Comment options

You must be logged in to vote
3 replies
@alec1o
Comment options

@1101728133
Comment options

@alec1o
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
2 participants