Home » U++ Library support » U++ MT-multithreading and servers » Non-Blocking socket example
Re: Socket example? [message #11024 is a reply to message #11012] |
Wed, 15 August 2007 04:51 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
Could this help as a starting point for your server part:
#include <CtrlLib/CtrlLib.h>
#include <Web/Web.h>
using namespace Upp;
#define LAYOUTFILE <P2PSocket/P2PSocket.lay>
#include <CtrlCore/lay.h>
class SocketApp : public WithMainLay<TopWindow> {
Socket sock;
public:
void SSwitch();
typedef SocketApp CLASSNAME;
SocketApp();
};
void SocketApp::SSwitch()
{
if (ssw==0) {
sock.Close();
PromptOK("4662 socket server CLOSED. You can check it with nmap command");
}
else if (ssw==1) {
ServerSocket(sock, 4662, true, 5, false);
PromptOK("4662 socket server OPENED. You can check it with nmap command");
}
else
PromptOK("Warning: check your switch inits!");
}
SocketApp::SocketApp()
{
CtrlLayout(*this, "P2PSocket Server");
ssw.SetLabel(0, "STOP 4662");
ssw.SetLabel(1, "START 4662");
ssw=0;
ssw.WhenAction = THISBACK(SSwitch);
Sizeable().Zoomable();
}
GUI_APP_MAIN
{
SocketApp().Run();
}
P2PSocket.lay:
LAYOUT(MainLay, 400, 200)
ITEM(Switch, ssw, HSizePosZ(144, 172).VSizePosZ(68, 96))
END_LAYOUT
|
|
|
|
|
Non-Blocking socket example
|
|
|
Re: Socket non block
By: lundman on Wed, 18 April 2007 09:33
|
|
|
Re: Socket non block
|
|
|
Socket example?
By: lectus on Thu, 09 August 2007 20:59
|
|
|
Re: Socket example?
By: bonami on Fri, 10 August 2007 04:55
|
|
|
Re: Socket example?
By: lectus on Fri, 10 August 2007 05:57
|
|
|
Re: Socket example?
By: bonami on Fri, 10 August 2007 08:16
|
|
|
Re: Socket example?
By: lectus on Mon, 13 August 2007 16:58
|
|
|
Re: Socket example?
By: fudadmin on Mon, 13 August 2007 18:34
|
|
|
Re: Socket example?
By: lectus on Mon, 13 August 2007 21:00
|
|
|
Re: Socket example?
By: fudadmin on Mon, 13 August 2007 22:52
|
|
|
Re: Socket example?
By: mezise on Mon, 13 August 2007 23:32
|
|
|
Re: Socket example?
By: lectus on Tue, 14 August 2007 04:06
|
|
|
Re: Socket example?
By: fudadmin on Wed, 15 August 2007 04:51
|
|
|
Re: Socket example?
|
|
|
Re: Socket example?
By: lectus on Wed, 15 August 2007 20:33
|
|
|
Re: Socket example?
By: fudadmin on Thu, 16 August 2007 08:12
|
|
|
Re: Socket example?
By: mirek on Fri, 17 August 2007 19:21
|
|
|
Re: Socket example?
By: fudadmin on Sun, 19 August 2007 14:23
|
|
|
Re: Socket example?
By: lectus on Sun, 19 August 2007 17:23
|
|
|
Re: Socket example?
By: fudadmin on Mon, 20 August 2007 01:58
|
|
|
Re: Socket example?
By: fudadmin on Mon, 20 August 2007 21:24
|
Goto Forum:
Current Time: Fri May 10 12:57:29 CEST 2024
Total time taken to generate the page: 0.46454 seconds
|