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