Send Message to remote PC in local network [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
How can I in c# send Message box to remote computer? I have credentials of remote PC and know PC name. Can use for this purpose WMI?

Look into the NET SEND command. However, the messenger service needs to be enabled on the remote computer - you could use PSEXEC to start this.

I think you're asking how to send a message to a remote computer via c#. If so, you have several options see below:
Microsoft message queuing - Only if you need a super robust framework that gauarantees delivery of your message even if destination goes offline.
UDP multicast message - You can use the System.NET.Sockets namespace to send UDP packets and build a client to listen for them which can be run of n number of remote server. This is not error checking and if the remote server is not up then you are out of luck.
TCP socket connection - You can use the System.NET.Sockets namespace to send TCP packets and build a client to listen for them which can be run of n number of remote server. This is error checking and if the remote server is not up then you are out of luck.
Hope this gives you some direction.
Enjoy!

Related

Send a open port request to router [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am creating a peer to peer application in c sharp, I was wondering if it was possible to send a request to the other persons router over the internet and ask it to open port 1234, or if there is any other way of uploading and sending data without port forwarding, or even an application that i can port forward my router via command line or dll would be great. Please help me for this is making me frustrated.
There is no way for an outside app to tell a router to open a port to one of its local machines. This would be a huge security hole.
If a local machine wants access from outside, it could use UPnP (NAT Traversal) to tell the router to forward a port to it (or you could simply configure your router to forward the port).
If both peers are behind NAT with no access to port forwarding, you would have to use some 3rd party server that proxies the data.

How can server PC access the SQL Server data of Clients PC using Asp.net c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have more than 100 clients on different networks (not on LAN) e.g. one is in USA and other in UK and other in Dubai and so on.
My all clients PC using the same Windows application and their own local DB.and using internet with Router.as you know due to router public IP always change after 24 hour.
My server PC is in Australia and server is using web application.
Client PC can get access server PC using Windows Services.
But my question: how server pc will get the data from client PC's using web services or any in your mind?
Please give any good Idea with example of sample code, please don't give me any huge theoretical link to read. I want just sample code which I will write in my server side Web application and it will fetch data from clients PC .
Thank you.
You will more likely to succeed with syncing the clients with your server, not the other way round.
Syncing with the clients will bring about a whole host of security and configuration issues.
The opposite is a single server that all clients communicate with and send data.
The server can't fetch data from clients because off firewalls and dynamic IPs (which you pointed out). I think the clients will have to upload the data to the server. Can you tell us more about the "Windows Services" that enable the client to communicate with the server? Perhaps you can use this t allow clients to upload data to the server?

What is the right programing model for global chat app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am trying to build a chat app in c# that would work in the wan network.
There are 2 side in the app. Server side and client side.
In my thoughts i think that every message from client to client need to be passed to the server and the server will forward it to the right des client. The communications between the clients wont be directelly.
Is this the right model?
If yes, does the server need to have one socket that will listen to all clients? (Because every client sends his message to the same port at server).
Will the sever can handle management of million of messages on same port?
I think it is really up to what you want to accomplish, each choice has it's own pros and cons.
For example:
Using a centralized server can track messages , which users are online etc... but you will have to manage the ports for each connection (see explanation at the end of the answer for details).
Using a P2P model, you will not have the bottle neck and management required by the centralized server, but again it might be more of a hassle to manage a non centralized system (depends what exactly you want to accomplish).
If you are going to the centralized design, Typically You would have a server with a port that will listen for requests.
once a user wants to connect, the server will start a new thread for the client, and will assign a port for him (the thread will be typically from a thread pool and the port from a specific port range).
this will allow users to speak to the server in a non-blocking manner, and by that allow for multiple users to use the service simultaneously.
Take a look at SignalR and the chat system implemented using SignalR, Jabbr:
http://signalr.net/
http://about.jabbr.net/

TCP between C# and C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm creating a server that will in most/all cases be run on the same machine as the client. The client will need to be able to send and receive messages from this server. Some of the received messages will not be answers to questions (such as with http requests). All the messages will hold is a string that the project then uses to determine what function needs to be run.
The question is "Do I need to connect on two ports: one for sending and one for receiving?" If I use tcplistener with C# and C++ POSIX for networking, can I just send and receive messages on the same port?
Yes. You can send and receive on the same port and that's the intended way to communicate with tcp.
EDIT
You have two actors, a host and a client.
The host... will open a local network port (that you specify) and listen for new connections and communications from clients.
The client... can (and probably should) choose it's own local port and connect to the host on the port you specified.
Both the host and client... can communicate over the established connection. The host can send data to the client as long as the client is listening.
Have the server bind to and listen on a well-known port. Have the client bind to any port (you can let bind pick for you) and connect to the server on its port. Exchange messages.
Yeah, there isn't a difference between tcp/ip.

Server connection to client behind NAT [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've made a server/client application in C#.
My question is the following: Let's say a client is behind an NAT (Like a router) and tries to connect to a server. From the server's perspective, the server only knows the client's external IP address. How do you determine exactly which computer to send the packets to that is behind an NAT? I understand port forwarding from the router on the client's end is a common way of solving these type of problems but if you look at applications like Skype, port forwarding is not necessary to properly establish a connection between the server and however many clients behind the NAT. This question can be asked vice-versa as well (I.E: client to server behind NAT).
I'm pretty new at socket programming so I'd love to hear any guidelines or materials that I can read over to fully understand this stuff.
You shouldn't worry about NAT in the application layer. If you receive a message with an IP say 200.51.255.79 you can send the answer to the same IP. Routers will handle the NAT and further routing automatically. It's not like this with port forwarding of course but it is with NAT.
Skype works in a very interesting way to get around port forwarding and firewalls using a server sided database of current ips and ports where each user is waiting for a response. You should look that up on the internet for a full explanation. It's a really good read =).

Categories