Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with connecting windows service through sockets

Problem with connecting windows service through sockets

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lnmca
    wrote on last edited by
    #1

    Hi All, The problem that we are facing is that we are unable to connect the windows service through the socket running on computer A from the windows application running on computer B. The following are the steps that we have followed. At Window Service Side running on Computer A:- · We have created a window service and under OnStart event we have initialize the object of TCP listener through port 8001. · Start the TCP listener. · Made a thread for WaitingForClient and start this thread so that it always lies in listen mode for accept the socket from Computer B. · In the method WaitingForClient we have accepted the socket and start another thread for read this socket. At Window Application running on Computer B:- Made a socket that has AddressFamily InterNetwork, SocketType is stream and ProtocolType is TCP. Made the object of IPEndPoint by initialize it through IP address of Computer A and Port 8001. When we connecting this socket to the Computer A through IPEndPoint, it does not connect and throws the exception of connection timeout. Plese Help............ Thanks and Regards, Lalit Narayan

    N 1 Reply Last reply
    0
    • L lnmca

      Hi All, The problem that we are facing is that we are unable to connect the windows service through the socket running on computer A from the windows application running on computer B. The following are the steps that we have followed. At Window Service Side running on Computer A:- · We have created a window service and under OnStart event we have initialize the object of TCP listener through port 8001. · Start the TCP listener. · Made a thread for WaitingForClient and start this thread so that it always lies in listen mode for accept the socket from Computer B. · In the method WaitingForClient we have accepted the socket and start another thread for read this socket. At Window Application running on Computer B:- Made a socket that has AddressFamily InterNetwork, SocketType is stream and ProtocolType is TCP. Made the object of IPEndPoint by initialize it through IP address of Computer A and Port 8001. When we connecting this socket to the Computer A through IPEndPoint, it does not connect and throws the exception of connection timeout. Plese Help............ Thanks and Regards, Lalit Narayan

      N Offline
      N Offline
      Nicholas Butler
      wrote on last edited by
      #2

      Does it work if you run the client and service on the same machine? If so, it's probably a firewall blocking your port. Nick

      ---------------------------------- Be excellent to each other :)

      L 1 Reply Last reply
      0
      • N Nicholas Butler

        Does it work if you run the client and service on the same machine? If so, it's probably a firewall blocking your port. Nick

        ---------------------------------- Be excellent to each other :)

        L Offline
        L Offline
        lnmca
        wrote on last edited by
        #3

        Hi Nick, Thank u very much,u have solved my problem in one line,i have just turn off my firewall and my program started working. Regards, Lalit Narayan

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups