LordoToasty
LordoToasty
CC#
Created by LordoToasty on 5/26/2024 in #help
Byte array to BitArray
No description
2 replies
CC#
Created by LordoToasty on 5/26/2024 in #help
System.ArgumentOutOfRangeException: Pls Help :.)
No description
6 replies
CC#
Created by LordoToasty on 12/21/2023 in #help
PCP request to router (port forwarding) problem.
Hi and thank you for opening this post and considering helping me,...I want my application to "forward" a port for TCP traffic, tho till now I've been using UpNP which, from what I found out is pretty insecure and it does not work always due to it being disabled, so I wanted to attempt to do the port forwarding via PCP, but for the UpNP I used the mono.nat library so it was pretty easy to get around and that's why I don't get how to construct the message. I found the documentation and the passage that contains the format of how the message is supposed to be formatted like, tho I have no idea how to do do that in C#, should I use mappings or perhaps sockets? ...and how to implement.
5 replies
CC#
Created by LordoToasty on 12/12/2023 in #help
CS0122, just with a partial class...
Hey there, my plan is to call a variable from another class(all necessary methods and classes are public), just that the class I want to call from is is a partial one, do I have to necessarily call from a normal kind of class(non-partial)?
18 replies
CC#
Created by LordoToasty on 12/10/2023 in #help
Timer, devideFound and Background Thread!
Hi and thank you for coming to try to help me. I have my code done and working already, but there is on thing bothering me about it, related to the Title of this post. My problem is, that I want to call "DeviceFound" (Mono.nat lib) every 120s due to the expiration of the port forward being 120s. I tried making a timer which will repeat the deviceFound every two minutes, but it didn't work, the same for creating a new thread, as all the treads will get blocked due to the last one being always active and the program not wanting to do anything till it is exited, but that would mean a restart of the server, which is the thing I want to avoid, I added the related Code down below, excluding the timer and thread I have tried making. I really appreciate any kind of help!
29 replies
CC#
Created by LordoToasty on 12/5/2023 in #help
"netsh" cmd Commands not being executed
Well, I am trying to set up some firewall-rules and such, the problem is non of the commands is being properly executed. I got to the conclusion while looking for why the server does not work. My approach was to try to delete the firewall rule after running the program, as of proof for that it existed in the first place, it turned out, it didn't, my code is:
11 replies
CC#
Created by LordoToasty on 12/4/2023 in #help
I gotta fix tha "mappings.Add()", It allways calls null, pls help (UPnP)
No description
3 replies
CC#
Created by LordoToasty on 11/27/2023 in #help
I have a problem with the socet.ReciveFrom(), can someone Help pls?
private void PortForwardProcess(object sender, RoutedEventArgs e) { int targetPort = 4789; // A port to type in. int port = int.Parse(Console.ReadLine()); // Socket erstellen Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); // Zieladresse und -port festlegen IPAddress address = IPAddress.Parse("0.0.0.0"); // Port anfordern // PCP-Nachricht erstellen byte[] message = Encoding.UTF8.GetBytes("PCP\nR\n0\n0\n" + port + "\n" + address.ToString() + "\n" + targetPort); // Nachricht senden socket.SendTo(message, 0, message.Length, SocketFlags.None, new IPEndPoint(address, targetPort)); IPEndPoint senderRemote = new IPEndPoint(IPAddress.Any, 0); EndPoint endpoint = new IPAddress(IPAddress.Any, 0) ; // Antwort empfangen byte[] response = new byte[1024]; socket.ReceiveFrom(response, 0, response.Length, SocketFlags.None, endpoint ); // Antwort prüfen if (response[0] == 'A') { // Portforwarding erfolgreich eingerichtet Console.WriteLine("Portforwarding erfolgreich eingerichtet!"); } else { // Portforwarding fehlgeschlagen Console.WriteLine("Portforwarding fehlgeschlagen!"); } try { // Portforwarding-Regel entfernen, wenn das Programm beendet wird // ... } finally { // Socket schließen socket.Close(); } }
88 replies
CC#
Created by LordoToasty on 11/19/2023 in #help
xaml and x:Class - issue (CS1061)
I got a project wich some of you helped me with allready, tho there is still one issue I coudn't resolve. That would be the error CS1061, it says, that possibly a using-Directive or a assembly reference is missing. I provided the vs-Project in a RAR file and I'll send the C#-code and XAML separately too if you don't want to unpack the RAR-file for whatever reason.
3 replies
CC#
Created by LordoToasty on 11/19/2023 in #help
I have a Visual-Studio Proj. in .NET Framework and need help fixing the "CS0120" error it throws up.
Basically I want to make an App which you just run and it will automatically, by pressing just one button, create and set up a Minecraft server, for that I had to convert a string in to Uri, I had problems with it but I was able to fix it at last, tho right after that it started to punch me down with a CS0120 error which I couldn't resolve.
13 replies