0

I want to create a window service (TCP/UDP) based on my local computer. I want to send data to this service from anywhere. Lets suppose I have a static IP (1.2.3.4) and I want to listen at port (4321). My local computer is behind a Router. Router's WAN static IP is (1.2.3.4).

How to create a service for this?

halfer
  • 19,471
  • 17
  • 87
  • 173
coure2011
  • 37,153
  • 75
  • 206
  • 328

4 Answers4

2

You just create a regular service. If you want to allow access from anywhere, then set up port forwarding on your router.

Stephen Cleary
  • 406,130
  • 70
  • 637
  • 767
1

You really need to check Windows Communication Foundation and host a service in a Windows service.

Check how to do an UDP service with WCF:

And for TCP, just read this other article:

I'll suggest WCF in order to avoid reinventing wheels.

Matías Fidemraizer
  • 61,574
  • 17
  • 117
  • 195
0

You can use UdpClient or TcpClient, have a look here. It's another question but there are some snippets you can copy, and it's a start.

halfer
  • 19,471
  • 17
  • 87
  • 173
Davide Piras
  • 43,118
  • 10
  • 90
  • 143
0

As stephen said, use port forwarding.

Here you have a little information on how http://portforward.com/help/pfprogression.htm

Bakery
  • 396
  • 1
  • 3
  • 10