How SuperWebSocket aplication works on diffrenet host?

Jul 25, 2012 at 4:22 PM

I have created my application with SuperWebScoket and it works in localhost.  What do I need to change on Global (i.e Port,..) in order to works on diffrenet host but not localhost?

Jul 25, 2012 at 6:43 PM

Listen ip and port are defined in web.config, you needn't change any code usually!

Jul 25, 2012 at 8:52 PM
Edited Jul 25, 2012 at 9:01 PM

yes, but how about in SuperWebSocket global?

Jul 26, 2012 at 5:12 AM

Could you read the code in Global and comprehend it?

Jul 26, 2012 at 8:58 AM

mostly yes, I have created my game and wrote the protocol logic there.  I do not really get the following part, I know is a port and IP config, do I need to change the following part in different host?

 

 var socketServer = new WebSocketServer();           

socketServer.Setup(new RootConfig(),               

new ServerConfig {                   

Ip = "Any",                   

Port = 2011,

Mode = SocketMode.Async               

},SocketServerFactory.Instance);

socketServer.CommandHandler += new CommandHandler<WebSocketSession, WebSocketCommandInfo>(socketServer_CommandHandler);            socketServer.NewSessionConnected += new SessionEventHandler<WebSocketSession>(socketServer_NewSessionConnected);           

socketServer.SessionClosed += new SessionClosedEventHandler<WebSocketSession>(socketServer_SessionClosed);

var secureSocketServer = new WebSocketServer();           

secureSocketServer.Setup(

new RootConfig(),               

new ServerConfig{                   

Ip = "Any",                   

Port = 2012,                   

Mode = SocketMode.Sync,                   

Security = "tls",                   

Certificate = new SuperSocket.SocketBase.Config.CertificateConfig{                       

FilePath = Server.MapPath("~/localhost.pfx"),                       

Password = "supersocket",                       

IsEnabled = true;}}, SocketServerFactory.Instance); 

Jul 26, 2012 at 11:32 AM
I suggest not hard code up and port in code. I think loading from configuration is a good practice.

Sent from my Windows Phone

From: samjelveh
Sent: 7/26/2012 3:58 PM
To: kerry-jiang@hotmail.com
Subject: Re: How SuperWebSocket aplication works on diffrenet host? [SuperWebSocket:389006]

From: samjelveh

mostly yes, I have created my game and wrote the protocol logic there. I do not really get the following part, I know is a port and IP config, do I need to change the following part in different host?

var socketServer = new WebSocketServer();

socketServer.Setup(new RootConfig(),

new ServerConfig {

Ip = "Any",

Port = 2011,

Mode = SocketMode.Async

},SocketServerFactory.Instance);

socketServer.CommandHandler += new CommandHandler<WebSocketSession, WebSocketCommandInfo>(socketServer_CommandHandler); socketServer.NewSessionConnected += new SessionEventHandler<WebSocketSession>(socketServer_NewSessionConnected);

socketServer.SessionClosed += new SessionClosedEventHandler<WebSocketSession>(socketServer_SessionClosed);

var secureSocketServer = new WebSocketServer();

secureSocketServer.Setup(

new RootConfig(),

new ServerConfig{

Ip = "Any",

Port = 2012,

Mode = SocketMode.Sync,

Security = "tls",

Certificate = new SuperSocket.SocketBase.Config.CertificateConfig{

FilePath = Server.MapPath("~/localhost.pfx"),

Password = "supersocket",

IsEnabled = true;}}, SocketServerFactory.Instance);

Jul 27, 2012 at 11:45 AM
Edited Jul 27, 2012 at 11:56 AM

Thanks,  do I have to change the below setting from my web Config?  

do I have to change the server name and service name?  how about the port number? I really need to upload my application in to the different host and I did change the IP but nothing has been changed (the other attribute were remain the same).    

 

<socketServer>   

<servers>     

<server name="SuperWebSocket"              serviceName="SuperWebSocket"              ip="Any" port="2011" mode="Sync">     

</server>     

<server name="SecureSuperWebSocket"              serviceName="SuperWebSocket"              ip="Any" port="2012" mode="Sync" security="tls">       

<!--Please install the certificate to your trusted certificates store, the password is 'supersocket'-->       

<certificate filePath="localhost.pfx"                     password="supersocket"                     isEnabled="true"></certificate>     

</server>    </servers>   

<services>     

<service name="SuperWebSocket"               type="SuperWebSocket.WebSocketServer, SuperWebSocket" />   

</services> 

</socketServer>