zylog
zylog
CC#
Created by zylog on 1/25/2023 in #help
✅ [[QUESTION]] HOW TO CALCULATE THE Rent(int) property for System.Buffers.ArrayPool<byte> ?
Hey, I have a question about System.Buffers.ArrayPool<byte> I tried to read the document many times but I didn't get it. what is the Rent(int) property of System.Buffers.ArrayPool<byte> ? How do I know how many bytes I need for the buffer? If I need a string of 5 characters, Rent(5) is enough ... I know that and it works. but what if I need : 1 - String(5 character) 2 - bool 3 - Int(1 digit ) (1-5) 4 - Int(1 digit ) (1-5) 5 - Int(1 digit ) (1-5) 6 - Int(1 digit ) (1-5) How do I calculate the Rent value I need?
104 replies
CC#
Created by zylog on 12/24/2022 in #help
❔ How to get IP address of the Client whom is trying to connect to my server?
hey, as a C# server, how do I get the client's public Ip Address ? on python we used to just get the request object and look at ip_address property on it, not sure how to do that in c# and the alternative ways I saw how was pretty dum in my opinion ,it goes like this
string ipAdd = webClient.DownloadString("https://api.ipify.org/");
string ipAdd = webClient.DownloadString("https://api.ipify.org/");
then they trim and replace the string to just get ip address without any extra symples. there must be a way for C# as a server to know the IP of comming connections rather than that mess I've mentioned above ... requests come from a public Ip address
3 replies