Jump to content
Sign in to follow this  

Recommended Posts

Hello All,

 

I'm new to building addons in Arma. I have gotten cfgpatches built to modify and addon user actions to vehicles, however I'm trying to build and addon for Arma to use a .dll to send data to a local UDP server. The build works but when launching Arma it says that it cannot find the function. I've tried a bunch of file path changes but I'm not having any luck. Could someone look at my code please and see where I might be going wrong? Thanks in advance. 

 

Here's the addon. File Folder UDPClient

class CfgPatches
{
    class UDPClient
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {};
        author = "Griz";
        name = "UDP Client";
        url = "";
    };
};

class CfgFunctions
{
    class UDPClient
    {
        class UdpSender
        {
            file = "UdpSender";
            class Send {};
        };
    };
};

 

............

Here is the script for my .dll written in c#

 

using System;
using System.Net;
using System.Net.Sockets;

public class UdpSender
{
    public static void Send(string message, int port, string ipAddress)
    {
        UdpClient udpClient = new UdpClient();
        IPEndPoint serverEndpoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);

 

        byte[] data = System.Text.Encoding.ASCII.GetBytes(message);

 

        udpClient.Send(data, data.Length, serverEndpoint);

 

        IPEndPoint remoteEndpoint = new IPEndPoint(IPAddress.Any, 0);


        byte[] receiveData = udpClient.Receive(ref remoteEndpoint);

 

        string receiveMessage = System.Text.Encoding.ASCII.GetString(receiveData);
        Console.WriteLine("Received response from server: " + receiveMessage);
    }
}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×