locked
Socket? On the client or server? RRS feed

  • Question

  • Hi guys.

    I'm developing a silverlight application and now I have this scenario....When I finish a process in server and return a result using a WCF to client I call a socket TCP (from client) to send a message to a windows service (into server). But imagine that I have 100 clients connected in my application and in the same time all clients send a message by socket TCP to the windows service. How will my LAN?

    I wanna know what is recommended to do? Each client have your "socket client" to communicate with windows service or I put the routine of "socket send message" in the server?

    Note: The application will be in the same web server (computer) of the windows service.

    Or I should use other technology? I heard about "MSMQ".

    Please help me to choose the best way (socket client in the client or server) and technology (socket or MSMQ or other?)

    Thank advance.


    Atenciosamente, Seratti.

    Tuesday, June 10, 2014 6:42 PM

All replies

  • Your question really about credentials and security.  One main reason for developing a WCF is to handle security.  Your WCF is a two port service.  One port connects to the clients and the second port connects to the Server.  The WCF acts as a relay between the clients and the server. 

    You don't want any client just connecting to the server.  So the WCF service should be the only client that will connect to the server.  The WCF verifies the credentials of the clients before allowing any messages to be sent to the Server.


    jdweng

    Wednesday, June 11, 2014 4:04 AM
  • I am unable to understand what you are trying to achieve here. May be a simpler design of Communication mechanism can resolve the problem.

    What I understood from your description is:  

    You have a Server and a number of clients

    Client Communicates to Server using WCF. i.e. Client calls a method ... server processes and returns result over WCF channel.

    Now, you also have a Windows Service running on Server machine, and you have to communicate with it using TCP sockets. Is my understanding right?

    If Yes, then one way to address your concern is to use UDP multicast/braodcast.
    Server can open a UDP multicast channel and listen on it. Clients can post to this channel with a 

    propreitary message having Client Identifier and Message in it.

    Let me know if you need more details.

    Wednesday, June 11, 2014 5:50 AM
  • Joel Engineer, thank you for help.  Yes my WCF works like a relay. Just will receive a command (CRUD) from client to send to my server and AFTER finish the CRUD command and BEFORE to return the result to the client my WCF "send" a message to my Windows Service using Socket. Is this way right?

    Prateek_Shrivastava, thank you for help. Yes you are correct about my case but I cannot use the UDP Socket because I cannot lost anything....I need have certainty of receive message. Now I'm using Socket TCP, this means that my WCF returns the result to my client and from client I send a socket TCP to the windows service. Whats do you think about that?

    Thanks a lot.


    Atenciosamente, Seratti.

    Wednesday, June 11, 2014 6:49 PM
  • Yes and No.  You are correct from a Transport Network Layer, but not necessarily from an application layer.  I think there still need to be some design considerations like the following

    1) Is you design many - to - one, or many to many?  Many client connections to one server connection, or does each client connection have a separate server connection?

    2) Do you need to know when each command/response terminates?

    3) How do you plan to disconnect a client?

    4) In a many to one configuration do you plan to buffer commands to server so only one client message gets sent to server at a time, or do you plan to process commands in parallel?  How to you plan to tag each command?


    jdweng

    Thursday, June 12, 2014 12:00 AM