I have client and server application on C#. The client and server contact each other through a network socket.
I need pass some data from the client to the server. I used binary serialization for it, but I need to check that the users who starts the client part have permission to do that on the server part.
Only sending the user name is not enough, because it could be compromised.
Maybe it should be able to do with serialization of WindowsIdentity.GetCurrent(), but I couldn't do it.
How do I send credentials from the client to the server and check it on the server side? Is it possible?
Related
I have about 300 remote computers that send data to my server. i have a windows service that i made with a console aplication which reads data from energy meters and sends alarms via email. I need to know if one of them is offline for more than one day.
the remote clients doesnt have a fixed IP address so i assume that the client would have to make the contact.
i toghut about using signalIR to send a simple messeage to the server and let it know that the client is online, but i have no idea how to do it. i also raed about helth checks but i am not sure that's what i need.
what will be the easiest way to send a short message from a client to a server?
Thank you, Shay.
Is it possible to send message from one client to another client that is connected to the same server?
I want send data from one client to server Then send to specific client. I think I need to get client ID but I dont know how to get this id and how to send this message to that client from server.
I have a sample here. This is a chat server-client application. Multiple clients can connect to the server. When a client writes a message, the server simply broadcasts it for all clients who are receiving server stream RPC.
https://github.com/cactuaroid/GrpcWpfSample
See these server side implementation. When a client calls Subscribe(), it awaits m_chatService.Added event. When a client calls Write(), it raises the event and event args ChatLog is written on responseStream.
https://github.com/cactuaroid/GrpcWpfSample/blob/f6e8c4b2493c23cdcbaffeca29b5bb6705fbe95c/GrpcWpfSample.Server/Grpc/ChatServiceGrpcServer.cs
https://github.com/cactuaroid/GrpcWpfSample/blob/f6e8c4b2493c23cdcbaffeca29b5bb6705fbe95c/GrpcWpfSample.Server/Model/ChatService.cs
You can add your logic such as specifying channel name to subscribe/write, or define OpenChannel(string password) to be called by client at the first time so that server can bind the client IP address to the channel, whatever as you like.
There's no special gRPC feature that would allow you to do this (all RPC are between a server and a client, there's no "broadcast" or "selective broadcast" feature to reach out to other clients connected to the same server.
The logic you want is something that can definitely be implemented and but details of such solution depend on your need. A naive approach that might work is e.g. this:
each client opens a bidi-streaming call to the server
server keeps a directory of connected clients
once server receives a message from a client, it selects which client it should forward to based on the directory.
server forwards the message to a client.
Needless to say this setup feels a bit complicated (you're basically implementing your own network protocol on top of gRPC), so even though it might be just the right thing for you to do, it would make sense to think about how to simplify the protocol so that you can use features directly supported by gRPC.
I am trying to make a peer to peer chat program. the scenario is much more complicated but I will simplify it to get help in the the part where its needed.
as a summary:
A- The Server
There is a server waiting for clients to connect, when a client connects it will be kept as waiting till the next client connects.
When the 2nd client connects to the server the server will return to each client the ip and the port of the other client, so both client can talk to each other without intervention of the server.
Then the server back to 1
B- The client
the client start a tcpClient connection with server.
wait the server response.
client receive a custom object that contain the ip and the port of
the other client
start chatting with the other client using the ip:port provided by
the server of the other client.
The question is: is this possible considering network and firewall security configuration (default) on the client machine?
The client might be behind pating or nating router.
The application is going to run on the internet or local network.
Note: the thing i need help is it possible in C# to implemented the client part of the application to act as server and listen to a port and receive connections knowing that the port is not configured on the possible front end router;
Are there alternative solutions? The main idea is to keep the server out of the picture after server step 2
I have a few questions regarding sockets, I searched but couldn't find a direct answer.
I have a login server, and a world server. I connect from the TcpClient to the TcpListener on the login server. I want both a Tcp and a Udp connection on the world server, so once login has been checked, I redirect the TcpClient to the world server using TcpClient.Connect.
After this process, I tell the client to connect via Udp to the login server, and then use Socket.Connect to forward again to the world server.
The reason I'm forwarding and not sending client messages to the client to redirect, is that I only want to expose the login server IP and port to the client.
I'm not experienced with sockets, is there a better way to redirect without exposing the world server IP and port?
You can check the image on this page: http://next-gen.cc/
What you are looking for is a connection server that will maintain one connection to a client socket and keep the state of the client (connected, authenticated, playing, disconnected).
Once the player logs in, the connection server opens its own socket to the right game server and forwards all messages there, also when a game server wants to send the client data it will send it to the connection server which in turn sends it to the client.
In other words, make your login/connection server function as a router between the client and your game world.
What do I need to secure communication between Client, Server, AdminConsole (on another Client Computer).
I've the following scenario:
AdminConsole (Client2) perform some action (call WCF Server) --> WCF Server (handle action and transmit it to the specific client via another WCF call) --> Client1 (with WCF Service in Windows Service)
Do I have to create for all Clients like Client1 a SSL certificate?
-> So for 100 clients = 100 client SSL certs?
Or is it enough to secure just the WCF Server with a SSL certificate?
To a degree it depends on what you're trying to do.
If you simply want the client to know its connected to the right server and make the communication confidential and with guaranteed integrity (no one can change things without you knowing) then you just need an SSL cert on the server
If you need the server to know who the client is so it can do audit / authorization then the client must have some way to identify itself to the server. There are a number of options here depending on your requirements from Windows credentials, to custom usernames and password, to client certificates to SAML tokens
You only need an SSL certificate for the Server - each client doesn't need one :)