SmartCode Solutions Web Forum




ConnectionAccepted Event

Expand / Collapse
Author Message
 Posted Tuesday, January 05, 2010
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Wednesday, January 06, 2010
Posts: 3, Visits: 9
Hi,

In my application I have used the ConnectEx method to establish a connection to my server.

I have added the Disconnected Event and the ConnectionAccepted Events.

In the Disconnected event method call I have called the ListenEx method on the port I am using.

In the ConnectionAccepted method call, i have called ConnectEx again to re-establish the connection and then StopListen().

I was expecting the Disconnected event method call to start listening for a reconnection to the server and then the control would fire the ConnectionAccepted event when the server recovers but the ConnectionAccepted event is never fired. Am I missing something or have I interepreted the events and methods supplied incorrectly?

Any help on this would be greatly appreciated,

Karen

Post #2876
Add to Twitter Add to Facebook
 Posted Tuesday, January 05, 2010
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2 days ago @ 4:49 PM
Posts: 1,248, Visits: 2,125
Hi Karen,
ConnectionAccepted gets fired when a listening ViewerX accepts incoming connection from a VNC server. So if you have received this event it means that connection from a VNC server has been accepted and VNC session is in progress.

The Connected event is fired when you establish connection via one of the ConnectXXX methods.

Please note that if you want ViewerX to be in listening mode after a connection was closed. You would have to call Listen/Ex method in the Disconnected event handler.

Please let me know if you need any additional assistance.



Kindest Regards,
SmartCode Solutions Support

Post #2877
Add to Twitter Add to Facebook
 Posted Tuesday, January 05, 2010
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Wednesday, January 06, 2010
Posts: 3, Visits: 9
Hi,

I have included the basic format of my code below. If I start my application with the VNC Server running on the other PC then it connects fine. When I stop the server running on the other PC the disconnected event is fired. But after that when I restart the VNC Server on the other PC the ConnectionAccepted event is never fired. Any idea why this event is not fired?

Thanks, karen

public VNCPage ()

{

InitializeComponent();

viewerX.ConnectEx( "PCName", 5900, "hello" );

viewerX.Disconnected += new EventHandler( viewerX_Disconnected );

viewerX.ConnectionAccepted += new AxViewerX._ISmartCodeVNCViewerEvents_ConnectionAcceptedEventHandler( viewerX_ConnectionAccepted );

}

void viewerX_ConnectionAccepted( object sender, AxViewerX._ISmartCodeVNCViewerEvents_ConnectionAcceptedEvent e )

{

viewerX.ConnectEx( "PCName", 5900, "hello" );

viewerX.StopListen();

}

void viewerX_Disconnected ( object sender, EventArgs e )

{

viewerX.ListenEx( 5900 );

}

Post #2878
Add to Twitter Add to Facebook
 Posted Tuesday, January 05, 2010
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2 days ago @ 4:49 PM
Posts: 1,248, Visits: 2,125
1. usually it's a good idea to subscribe to the events before calling Connect/Listen methods. So you should subscribe first and then doing the connecting stuff.

2. void viewerX_ConnectionAccepted  part is comletely wrong. As I mentioned, when you receive ConnectionAccepted even it means that VNC connection has been established.

Basically the code is a bit mish mash, you are establishing a VNC connection via the Connect method and at the same time want to run a listening VNC viewer.
Are you trying to establish connection from ViewerX to VNC server or want to run ViewerX in a listening mode?



Kindest Regards,
SmartCode Solutions Support

Post #2879
Add to Twitter Add to Facebook
 Posted Tuesday, January 05, 2010
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Wednesday, January 06, 2010
Posts: 3, Visits: 9
Hi,

Yes the code is a bit dodgy, it was a hack to try the control out. :)

Can you post an example of how to get the ConnectionAccepted event to be fired? I have tried just listening and starting the VNC Server on the other PC and nothing happens. :(

Thanks, Karen

Post #2880
Add to Twitter Add to Facebook
 Posted Tuesday, January 05, 2010
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2 days ago @ 4:49 PM
Posts: 1,248, Visits: 2,125
Please find sampe project attached.



Kindest Regards,
SmartCode Solutions Support


 ListeningViewerX.zip (40 views, 48.93 KB)
Post #2881
Add to Twitter Add to Facebook


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse