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,824
  • 17
  • 99
  • 186
coure2011
  • 40,286
  • 83
  • 216
  • 349

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
  • 437,863
  • 77
  • 675
  • 810
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
  • 63,804
  • 18
  • 124
  • 206
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,824
  • 17
  • 99
  • 186
Davide Piras
  • 43,984
  • 10
  • 98
  • 147
0

As stephen said, use port forwarding.

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

Bakery
  • 406
  • 1
  • 5
  • 10