Remoting from other machine doesn't work

Hello @all,

I have a problem with remoting. When I try to connect with my application from server A to server B the hostapplication throws the exception "Der Host war bei einem Socketvorgang nicht erreichbar" which means in english "The host was during a socket operation not reachable". The same application from server B to server B works - with the same config files for the remoting.

Is there something wrong with server A or with server B.

In the local network the application can connect from another machine to a server and it works fine.

Maybe someone knows a solution?

Cheers
Thomas
BorlandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mondayblueboyCommented:

Hi Borland,

Can I see your config file?
smeggheadCommented:
it may be a firewall / router / nat problem..

try the following (from the client)

open a command window & type..

telnet 123.123.123.123 1234

where 123.123.123.123 is the ip address of the server and 1234 is the port it is listening on.

if the window comes up as blank, press return 3 times and it should say something along the lines of 'expecting preamble'... otherwise it will come up with an error.

Good luck

Smg.
BorlandAuthor Commented:
@smegghead:
After using telnet and pressing return 2(!) times there came up this message:
".NET????????hServer encountered an internal error. To get more info turn on customErrors in the server's config file."

The connection is possible.

@mondayblueboy:
- server-config-file
<configuration>
      <system.runtime.remoting>
            <application>
                  <service>
                        <wellknown mode="Singleton" type="shCoordinator.classCoordinator, shCoordinator" objectUri="shPriceFeed"/>
                  </service>
                  <channels>
                        <channel ref="tcp" port="11111" name="PriceFeedServer">
                              <serverProviders>
                                    <formatter ref="binary" typeFilterLevel="Full"/>
                              </serverProviders>
                        </channel>
                  </channels>
            </application>
      </system.runtime.remoting>
</configuration>

- client-config-file
<configuration>
      <system.runtime.remoting>
            <application>
                  <client>
                        <wellknown type="shCoordinator.classCoordinator, shCoordinator" url="tcp://server:11111/shPriceFeed"/>
                  </client>
                  <channels>
                        <channel ref="tcp" port="0" name="PriceFeedClient">
                              <serverProviders>
                                    <formatter ref="binary" typeFilterLevel="Full"/>
                              </serverProviders>
                        </channel>
                  </channels>
            </application>
      </system.runtime.remoting>
</configuration>
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

smeggheadCommented:
Have you got the same version of the framework on both the client and the server ??
BorlandAuthor Commented:
@smegghead:
Yes, of couse. :-)
smeggheadCommented:
re: To get more info turn on customErrors in the server's config file

have you tried this ?? then try the telnet thing again ??
smeggheadCommented:
actually, try the telnet thing from the server, aswell, do you get the same error message ?
BorlandAuthor Commented:
@smegghead:
No, telnetting on the server raises this message:
".NET????????-?System.Runtime.Remoting.RemotingException: Tcp channel protocol violation: expecting preamble.
   at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
   at System.Runtime.Remoting.Channels.Tcp.TcpServerSocketHandler.ReadHeaders()
   at System.Runtime.Remoting.Channels.Tcp.TcpServerTransportSink.ServiceRequest(Object state)
   at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()"

So the problem is actually the communication between the two computers.

I'm going to activate the customErrors.
BorlandAuthor Commented:
@smegghead:
After activating customErrors I receive the same message like doing telnet on the server only. This is due to the standard value of customErrors. It is "remoteOnly", so remote connections receive filtered error messages, which is the shorter message above.
smeggheadCommented:
Do you get the same message when running the client now that customErrors has been activated ??

It might be something to do with callbacks, i.e. does the client have a firewall - and can the server connect to the client on a random port, if not, change the port="0" to something fixed and open the firewall for that port only.

BorlandAuthor Commented:
@smegghead:
Yes, I get the same message (the longerone).

The client or server has no firewall.
smeggheadCommented:
the longer one ? the 'expecting preamble' message ??

Or the german one ??

Just in case.. I meant when you actually run the client application. now that you have the customerrors activated.

Are the computers on the same LAN ?? I couldn't work out from your first post if that's what you meant.
BorlandAuthor Commented:
@smegghead:
I meant, after activating customErrors the message doing telnet FROM the client (to the server) was this:
".NET????????-?System.Runtime.Remoting.RemotingException: Tcp channel protocol violation: expecting preamble.
  at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
  at System.Runtime.Remoting.Channels.Tcp.TcpServerSocketHandler.ReadHeaders()
  at System.Runtime.Remoting.Channels.Tcp.TcpServerTransportSink.ServiceRequest(Object state)
  at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()"

The same message like doing telnet FROM the server (to the server).

The computers are on the same LAN in the same IP range.
smeggheadCommented:
and.. I meant.. if you run the client application again.. does it give you any more information ??? (now that customErrors has been activated)

Does your client machine have a .net debugger on it ?? if so, can you step through and determine exactly where the error is raised ??
BorlandAuthor Commented:
@smegghead:
The client application shows no error. The server shows the exception - the german one.
A debugger is not available.
smeggheadCommented:
try changing from port "0" on the client to something fixed, then, within your server application, before calling your event / callback put a console.readline(), then, while it is waiting for input from the console window, try telneting to the client on the port specified (from the server).
BorlandAuthor Commented:
@smegghead:
Telnetting the client application shows the same message:
".NET????????-?System.Runtime.Remoting.RemotingException: Tcp channel protocol violation: expecting preamble.
 at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)
 at System.Runtime.Remoting.Channels.Tcp.TcpServerSocketHandler.ReadHeaders()
 at System.Runtime.Remoting.Channels.Tcp.TcpServerTransportSink.ServiceRequest(Object state)
 at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()"
smeggheadCommented:
are you overriding the lifetimeservices ??? I remember getting this error when the MarshalByRef object was removing itself after the time out.
BorlandAuthor Commented:
@smegghead:
Yes, I do.
smeggheadCommented:
clutching at straws now..

try removing the <server providers> section from the config file, and change the channel to html.

BorlandAuthor Commented:
@smegghead:
Don't I need a webserver on the server for using HTML? If yes, it's not possible to change from TCP to HTML.
smeggheadCommented:
you don't need a webserver to use html (unless I'm completely mistaken) I think it just uses a different formatter.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ptmcompCommented:
The client config-File looks wrong to me:

Changed client-config-file:

<configuration>
    <system.runtime.remoting>
         <application>
              <client>
                   <wellknown type="shCoordinator.classCoordinator, shCoordinator" url="tcp://server:11111/shPriceFeed"/>
              </client>
              <channels>
                   <channel ref="tcp" port="1111" name="PriceFeedClient">
                       <clientProviders>
                             <formatter ref="binary" typeFilterLevel="Full"/>
                       </clientProviders>
                   </channel>
              </channels>
         </application>
    </system.runtime.remoting>
</configuration>

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gnconremotingsettingsschema.asp for details. If you want to do callbacks or you're using events in the remoted types then you also need to provide a callback channel(!) else there is no listener for the events from the server.

ptm
BorlandAuthor Commented:
@ptmcomp:
No, the file is correct because it works from-to the same machine and using a static port for the client is not possible for my application, because there is more than one client connecting from the same host.
Look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingChannelsTcpTcpChannelClassTopic.asp
"An integer specifying the port on which the channel will listen. To request that the remoting system choose an open port on your behalf, specify port "0" (zero)."

But I also tested it with a fixed port but this didn't work either.
ptmcompCommented:
Use a network monitor and look what's going on. You may temporary change the formatter to soap so the messages are human readable. (If you have MSDN Universal: There is a network monitor on the System Management Server CD.)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.