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. Only one usage of each socket address (protocol/network address/port) is normally permitted

Only one usage of each socket address (protocol/network address/port) is normally permitted

Scheduled Pinned Locked Moved C#
csharpsysadminhelpdatabase
5 Posts 4 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.
  • D Offline
    D Offline
    dwark106
    wrote on last edited by
    #1

    Hi All, I have a problem in C# Remoting. I am doing as given below code. I am also giving different Computername and Portname. Every time m_DisplayComputerName and m_lDisplayPort read from the Database. But Still I am getting error. "Only one usage of each socket address (protocol/network address/port) is normally permitted" //This is client and connection() funtion in Constructor private void Connection() { try { // First check if a Channel with the computername already exists. IChannel oChannel = ChannelServices.GetChannel(m_DisplayComputerName); if (oChannel == null) { // then we need to create. IDictionary props = new Hashtable(); props["name"] = m_DisplayComputerName; props["port"] = m_lDisplayPort; BinaryClientFormatterSinkProvider clientSink = new BinaryClientFormatterSinkProvider(); BinaryServerFormatterSinkProvider serverSink = new BinaryServerFormatterSinkProvider(); oChannel = new TcpChannel(props,clientSink,serverSink); //oChannel = new TcpChannel(props,null,null); ChannelServices.RegisterChannel(oChannel); } /*else { // do nothing }*/ } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } m_remoting = (RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface)Activator.GetObject( typeof(RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface), GetURL()); } private string GetURL() { return "Tcp://" + m_DisplayComputerName + ":" + m_lDisplayPort + "/RemotingKeyWord"; } ///////Server side And also in Constructor try { ChannelServices.RegisterChannel(new TcpChannel((int)(m_ResourceDetailsArray[0].DisplayPort))); } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } Thanks -- modified at 21:14 Saturday 7th January, 2006

    J S M 3 Replies Last reply
    0
    • D dwark106

      Hi All, I have a problem in C# Remoting. I am doing as given below code. I am also giving different Computername and Portname. Every time m_DisplayComputerName and m_lDisplayPort read from the Database. But Still I am getting error. "Only one usage of each socket address (protocol/network address/port) is normally permitted" //This is client and connection() funtion in Constructor private void Connection() { try { // First check if a Channel with the computername already exists. IChannel oChannel = ChannelServices.GetChannel(m_DisplayComputerName); if (oChannel == null) { // then we need to create. IDictionary props = new Hashtable(); props["name"] = m_DisplayComputerName; props["port"] = m_lDisplayPort; BinaryClientFormatterSinkProvider clientSink = new BinaryClientFormatterSinkProvider(); BinaryServerFormatterSinkProvider serverSink = new BinaryServerFormatterSinkProvider(); oChannel = new TcpChannel(props,clientSink,serverSink); //oChannel = new TcpChannel(props,null,null); ChannelServices.RegisterChannel(oChannel); } /*else { // do nothing }*/ } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } m_remoting = (RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface)Activator.GetObject( typeof(RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface), GetURL()); } private string GetURL() { return "Tcp://" + m_DisplayComputerName + ":" + m_lDisplayPort + "/RemotingKeyWord"; } ///////Server side And also in Constructor try { ChannelServices.RegisterChannel(new TcpChannel((int)(m_ResourceDetailsArray[0].DisplayPort))); } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } Thanks -- modified at 21:14 Saturday 7th January, 2006

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Is that code being run after you're running a server locally that uses the same port? Usually that error occurs when you've got 2 apps using the same port simultaneously.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Little House on the Flickr Judah Himango

      1 Reply Last reply
      0
      • D dwark106

        Hi All, I have a problem in C# Remoting. I am doing as given below code. I am also giving different Computername and Portname. Every time m_DisplayComputerName and m_lDisplayPort read from the Database. But Still I am getting error. "Only one usage of each socket address (protocol/network address/port) is normally permitted" //This is client and connection() funtion in Constructor private void Connection() { try { // First check if a Channel with the computername already exists. IChannel oChannel = ChannelServices.GetChannel(m_DisplayComputerName); if (oChannel == null) { // then we need to create. IDictionary props = new Hashtable(); props["name"] = m_DisplayComputerName; props["port"] = m_lDisplayPort; BinaryClientFormatterSinkProvider clientSink = new BinaryClientFormatterSinkProvider(); BinaryServerFormatterSinkProvider serverSink = new BinaryServerFormatterSinkProvider(); oChannel = new TcpChannel(props,clientSink,serverSink); //oChannel = new TcpChannel(props,null,null); ChannelServices.RegisterChannel(oChannel); } /*else { // do nothing }*/ } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } m_remoting = (RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface)Activator.GetObject( typeof(RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface), GetURL()); } private string GetURL() { return "Tcp://" + m_DisplayComputerName + ":" + m_lDisplayPort + "/RemotingKeyWord"; } ///////Server side And also in Constructor try { ChannelServices.RegisterChannel(new TcpChannel((int)(m_ResourceDetailsArray[0].DisplayPort))); } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } Thanks -- modified at 21:14 Saturday 7th January, 2006

        S Offline
        S Offline
        S Akif Kamal
        wrote on last edited by
        #3

        It is a bug in .Net 1.1 which has been removed in .Net 2.0. It only happens in case of abnomal shutdown of ur server. There are some tools available on .Net that will release the specifed port for u. Hope it will help u Akif

        1 Reply Last reply
        0
        • D dwark106

          Hi All, I have a problem in C# Remoting. I am doing as given below code. I am also giving different Computername and Portname. Every time m_DisplayComputerName and m_lDisplayPort read from the Database. But Still I am getting error. "Only one usage of each socket address (protocol/network address/port) is normally permitted" //This is client and connection() funtion in Constructor private void Connection() { try { // First check if a Channel with the computername already exists. IChannel oChannel = ChannelServices.GetChannel(m_DisplayComputerName); if (oChannel == null) { // then we need to create. IDictionary props = new Hashtable(); props["name"] = m_DisplayComputerName; props["port"] = m_lDisplayPort; BinaryClientFormatterSinkProvider clientSink = new BinaryClientFormatterSinkProvider(); BinaryServerFormatterSinkProvider serverSink = new BinaryServerFormatterSinkProvider(); oChannel = new TcpChannel(props,clientSink,serverSink); //oChannel = new TcpChannel(props,null,null); ChannelServices.RegisterChannel(oChannel); } /*else { // do nothing }*/ } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } m_remoting = (RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface)Activator.GetObject( typeof(RFDisplayStation_Remoting_Interface.IRFDisplaystation_Remoting_Interface), GetURL()); } private string GetURL() { return "Tcp://" + m_DisplayComputerName + ":" + m_lDisplayPort + "/RemotingKeyWord"; } ///////Server side And also in Constructor try { ChannelServices.RegisterChannel(new TcpChannel((int)(m_ResourceDetailsArray[0].DisplayPort))); } catch(System.Net.Sockets.SocketException ex) { MessageBox.Show(ex.Message); } Thanks -- modified at 21:14 Saturday 7th January, 2006

          M Offline
          M Offline
          mikailcetinkaya
          wrote on last edited by
          #4

          we had same problems. our solution was to wrap all channel and communication jobs in to a disposable class. That means after the container is shut untidily, with container disposition all goes disposing. you should contact this class with yor process as acontainer so if it goes also your class goes disposing... Mikail Çetinkaya . The C# DEveloper

          D 1 Reply Last reply
          0
          • M mikailcetinkaya

            we had same problems. our solution was to wrap all channel and communication jobs in to a disposable class. That means after the container is shut untidily, with container disposition all goes disposing. you should contact this class with yor process as acontainer so if it goes also your class goes disposing... Mikail Çetinkaya . The C# DEveloper

            D Offline
            D Offline
            dwark106
            wrote on last edited by
            #5

            Thanks for all. Yes I fixed it. Now it is running. Thanks a lot. -- modified at 13:29 Sunday 8th January, 2006

            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