Lasek
Lasek
CC#
Created by Lasek on 1/22/2023 in #help
❔ Enabling all CORS doesn't work
2 replies
CC#
Created by Lasek on 1/5/2023 in #help
Hi, I can't get to deserialize objects while sending them over a socket while using BinaryFormatter
that's the code for a server which receives data from client:
C#
using System.Net;
using System.Net.Sockets;
using System.Runtime.Serialization.Formatters.Binary;
using Data;
using System.Text;

var addr= await Dns.GetHostAddressesAsync("localhost");
IPEndPoint ipEndPoint = new IPEndPoint(addr[0], 2156);
using Socket serverSocket = new Socket(ipEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
serverSocket.Bind(ipEndPoint);
serverSocket.Listen(100);
Socket socket = await serverSocket.AcceptAsync();

using (var networkStream = new NetworkStream(socket))
{
int byt=0;
while (true)
{

BinaryFormatter binaryFormatter = new BinaryFormatter();
#pragma warning disable SYSLIB0011
DataPacket dataPacket= (DataPacket)binaryFormatter.Deserialize(networkStream);
Console.WriteLine(dataPacket.message);
#pragma warning restore SYSLIB0011
break;
}
}
C#
using System.Net;
using System.Net.Sockets;
using System.Runtime.Serialization.Formatters.Binary;
using Data;
using System.Text;

var addr= await Dns.GetHostAddressesAsync("localhost");
IPEndPoint ipEndPoint = new IPEndPoint(addr[0], 2156);
using Socket serverSocket = new Socket(ipEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
serverSocket.Bind(ipEndPoint);
serverSocket.Listen(100);
Socket socket = await serverSocket.AcceptAsync();

using (var networkStream = new NetworkStream(socket))
{
int byt=0;
while (true)
{

BinaryFormatter binaryFormatter = new BinaryFormatter();
#pragma warning disable SYSLIB0011
DataPacket dataPacket= (DataPacket)binaryFormatter.Deserialize(networkStream);
Console.WriteLine(dataPacket.message);
#pragma warning restore SYSLIB0011
break;
}
}
29 replies
CC#
Created by Lasek on 12/17/2022 in #help
❔ Using c sharp bindings of a c++ library
So i have a c sharp binding of a c++ library called FastNoise 2 https://github.com/Auburn/FastNoise2 and there is a c# binding https://github.com/Auburn/FastNoise2Bindings I want to use this binding in a .DotNet core, If anyone can help me with setting it up I will be thankfull
3 replies