C
C#8mo ago
Andrew Grimm

I'd like to ask for a little help from someone who has used the HttpServer class

I'm trying to implement this class in te Godot game engine but I can't make it receive http requests. I'm sending the requests through the HttpClient class from a .NET 8.0 page. I tried to simplify the code. The problem is that I don't get any print after queuing the GET request This is my .NET code The Service
using Lorendale.Web.Models;
using Lorendale.Web.Service.IService;
using Lorendale.Web.Utility;

namespace Lorendale.Web.Service
{
public class ArmoryService : IArmoryService
{
...
public async Task<ResponseDto?> GetArmoryAsync()
{
return await _baseService.SendAsync(new RequestDto()
{
ApiType = "GET",
Url = "localhost:6999"
});
}
}
}
using Lorendale.Web.Models;
using Lorendale.Web.Service.IService;
using Lorendale.Web.Utility;

namespace Lorendale.Web.Service
{
public class ArmoryService : IArmoryService
{
...
public async Task<ResponseDto?> GetArmoryAsync()
{
return await _baseService.SendAsync(new RequestDto()
{
ApiType = "GET",
Url = "localhost:6999"
});
}
}
}
I can give the code of the BaseService class but it limits me to 2000 words
9 Replies
Pobiega
Pobiega8mo ago
$paste
MODiX
MODiX8mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Pobiega
Pobiega8mo ago
This looks like a client thou, not a server
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
kurumi
kurumi8mo ago
where is HttpServer itself?
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Andrew Grimm
Andrew GrimmOP8mo ago
Hey guys, thank you for your replies What I'm trying to achieve is having my dedicated game server with API endpoints so I can consume them with a .NET webpage (right now I'm using 8.0) so I can show the chosen character equipment, name and statistics. All this information will be taken from the game server. Here is the whole code I'm using for this. BaseService.cs: https://paste.mod.gg/uqecxdobkobd/1 HttpServer.cs running on a Godot game instance: https://paste.mod.gg/uqecxdobkobd/0 The ArmoryController.cs that is used when clicking the API button: https://paste.mod.gg/uqecxdobkobd/2 The "public override void _Ready()" on the HttpServer.cs is basically the function that gets called first when the game starts. I have tested that it is run successfully. So to explain further these codes, in the ArmoryController.cs I have 2 console prints, and those are printed but the result is empty because the HttpServer is not receiving the request, and that's the thing I don't know how to search in the internet on how to solve it. Maybe it is a godot networking restriction? The HttpServer code is taken from this webpage https://thoughtbot.com/blog/using-httplistener-to-build-a-http-server-in-csharp thank you for your patience!
BlazeBin - uqecxdobkobd
A tool for sharing your source code with the world!
BlazeBin - uqecxdobkobd
A tool for sharing your source code with the world!
BlazeBin - uqecxdobkobd
A tool for sharing your source code with the world!
thoughtbot
Using HTTPListener to build a HTTP Server in C#
I needed an HTTP server to test out a software integration on Windows. Nothing was quite basic enough to just echo out the responses, so I wrote one.
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Andrew Grimm
Andrew GrimmOP8mo ago
I'll look into those things and post here how it went, along with the github project Got it working, you were right, I had too much useless code
Want results from more Discord servers?
Add your server