Send Text between two different computers C#

Hemanth B 886 Reputation points

Hi, I've been searching the web for this answer for a long time, but I don't get any useful answer. I want create an app which can send data to the same app however in a different computer with or without the same internet/wifi connection. I want this in such a way that there is no need to disable any firewall or any anti-virus software. I've tried many sources but those sources just keep throwing exceptions. Kindly help.

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,637 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 51,346 Reputation points

    I'm afraid there is no way to accept incoming requests from the internet without first making an exception in the firewall. Doing otherwise would be a huge security hole as anyone could then write an app that allowed malicious code to do this exact thing. Hence you cannot accept incoming network requests without a firewall exception. No workaround to this that would be in any way secure.

    You can initiate outgoing requests potentially without a firewall rule change but on most computers outgoing requests are also blocked by default. This is, again, for security reasons. The only program that wouldn't want you to do this is malicious software. Most apps simply add a rule when they install themselves so this shouldn't be an issue for a user.

    As for communicating across the Internet there are many different RPC options available. If you don't want to have to configure custom port stuff then HTTPS probably is the easiest but this requires you running a web server. For simple communications using a custom protocol then a regular TCP client/server app is sufficient. If you are building a "chat" like app then UDP is probably better but at the cost of reliability. There are plenty of examples online on how to build these types of apps in C#. Unfortunately they all require that you write a reasonable amount of code and you must understand how TCP/UDP works.

    0 comments No comments