The VNC Manager - SmartCode Solutions Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



ConnectionAccepted Event Expand / Collapse
Author
Message
Posted 1/5/2010 3:48:17 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/6/2010 6:10:46 AM
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
Posted 1/5/2010 7:11:07 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 7:10:09 PM
Posts: 1,163, Visits: 1,909
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
Posted 1/5/2010 8:09:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/6/2010 6:10:46 AM
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
Posted 1/5/2010 8:45:17 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 7:10:09 PM
Posts: 1,163, Visits: 1,909
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
Posted 1/5/2010 10:05:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/6/2010 6:10:46 AM
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
Posted 1/5/2010 8:17:29 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 7:10:09 PM
Posts: 1,163, Visits: 1,909
Please find sampe project attached.



Kindest Regards,
SmartCode Solutions Support

  Post Attachments 
ListeningViewerX.zip (26 views, 48.93 KB)
Post #2881
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Support (s-code), Alex (s-code)

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 9:02pm

Powered by InstantForum.NET v4.1.4 © 2010
Execution: 0.484. 10 queries. Compression Disabled.