Skip to Content
Former Member
Jun 22, 2005 at 08:50 AM

Problems with server connections (NCo 2.0, C#)


Hello all.

I have written a SAP server (.NET Connector 2.0, C#, runs as service) which opens

3 server connections to SAP.

From the SAPServerHost class I have derieved my own class

and overwritten the callback function OnServerException.

When this function is triggered by disconnecting my server from the network

I call the Stop method of the host instance.

In a separat thread I call the hosts Start method in intervalls

(like every minute) to try to reconnect to SAP again.

After reconnecting my server to the network the host is restarted and opens

3 connections to SAP again.


When I monitor my server connections in SAP (SMGW) I see 6 server connections

after reconnecting my server.

There are 3 corrupt connections that remain visible and which

I have to kill from within SMGW.


Are these 3 connections cleaned up by SAP after a while ?

Do I have to clean them up from within my server and if yes how do I do that ?

Here is my OnServerException method:

public override SAP.Connector.ActionOnServerException OnServerException(SAP.Connector.SAPServer server, System.Exception e)


if((this.ServerHostStatus != SAPServerStatus.Stopped) &&

(this.ServerHostStatus != SAPServerStatus.StopPending))




return SAP.Connector.ActionOnServerException.AutoReconnect;


Thanks a lot for all responses in advance,