none
Communication between two exe through socket progrraming c# RRS feed

  • Question

  • i want pass data from one exe to another exe by socket programing. suppose some time my exe1 will pass employee details to exe2 over the socket and some time exe2 will pass csv data to exe1 over the socket. each exe will some time behave as socket client and some time as socket server.

    there will be no separate exe for socket server end. how can i write that kind of socket communication program which will be itself socket server & client. if such kind of article exist then please inform me which may help me to write socket code which behave some time socket server end and some time socket client end. if possible help me with sample code. thanks

    • Moved by Lisa Zhu Wednesday, May 15, 2013 7:04 AM networking and communication
    Tuesday, May 14, 2013 6:47 PM

Answers

All replies


  • A WCF MSMQ service would be able to do it,  and each exe can send/receive data through the MSMQ, and it can be done over a network with each exe being a client and service. Or you can use WCF TCP/IP service  with each exe using a different port with communications over a network with being a client and service.  Legacy socket program is obsolete programming in .NET.

    • Marked as answer by Mou_kolkata Wednesday, May 15, 2013 7:56 AM
    Tuesday, May 14, 2013 7:08 PM
  • Consider

    NetPeerTcpBinding or worst case try System.Net.Sockets

    http://www.codeproject.com/Articles/17321/A-simple-peer-to-peer-chat-application-using-WCF-n


    Muthukrishnan Ramasamy
    net4.rmkrishnan.net
    Use only what you need, Reduce global warming

    • Marked as answer by Mou_kolkata Wednesday, May 15, 2013 7:56 AM
    Tuesday, May 14, 2013 7:23 PM
  • Hi Mou_kolkata,

    From your description, I ‘d like to move this post to  the most related forum.

    There are more  experts in this aspect, so you will get  better support and  may have more luck getting answers.

    Thanks for your understanding.

    Regards,


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 15, 2013 7:01 AM
  • why you said worst case try System.Net.Sockets why Sockets would not be good for this requirement. can u plzz explain what kins of problem may occur if people use socket ?
    Wednesday, May 15, 2013 2:16 PM
  • Sockets are not worst. As sockets are raw, but you need to write your own protocols between peers from the scratch. WCF has its own protocol to understand the language (messages) between them. You can use it. I am not discouraging you to not to use sockets. But you have a easy way with WCF.

    Muthukrishnan Ramasamy
    net4.rmkrishnan.net
    Use only what you need, Reduce global warming

    Wednesday, May 15, 2013 6:00 PM
  • thanks.
    Wednesday, May 15, 2013 7:02 PM