1

I have coded an addressbook program, which manages a list of contacts and so on. Now I want to be able to send one contact to another computer on the same local network. I am pretty new to C# (I started some months ago) and I have already read a lot about WCF, but it seems like I always would need some kind of server (like IIS) to host a service, where my client program would listen at. But what if I don't have anything like a server to host that service?

All I want to do is enter the IP of the computer who should receive the contact and then it will get the contact.

How can i achieve that on an "easy" way? I dont know much about TCP/Ip stuff yet.

The contact should be sent as string in XML format or as object (or whatever is possible).

Anantha Raju C
  • 1,780
  • 12
  • 25
  • 35
Whatever
  • 77
  • 1
  • 12

1 Answers1

0

I think that create a WCF service for your needs is not worth it, you only need to pass simple objects and WCF is much more powerful and much harder to use.
What I suggest that you use sockets for you needs, you can use the framework Socket Class, but TcpListener Class and TcpClient Class are much more easy to use.

If you need to pass your own types between the services you can use this method or you can just map them to an xmls.

Community
  • 1
  • 1
YuvShap
  • 3,825
  • 2
  • 10
  • 24
  • OKay thanks I have found an easy example for TcpListener and TcpClient: http://stackoverflow.com/questions/10182751/server-client-send-receive-simple-text (that is basicly the same as on msdn) And it works great for me, so I think i will use that for my use. – Whatever Sep 30 '16 at 11:30