Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

FLASH°²È«É³Ïä·þÎñÆ÷¶Ë³ÌÐò´úÂë(¿çƽ̨,C++/JAVA)

Main.cpp  (Win/*nix)
#include "FlexSecurityBox.h"
int main(int argc, char ** argv) {

char * address;
short port;
if (argc == 2)
{
address = "0.0.0.0";
port = atoi(argv[1]);
} else if (argc == 3)
{
address = argv[1];
port = atoi(argv[2]);
} else
{
printf("You have not to set listening port, we set default port is 843.\n");
address = "0.0.0.0";
port = 843;
}
FlexSecurityBox flexsecuritybox(address, port);
if (!flexsecuritybox.Open() )
{
printf("Socket Initialize Error");
exit(-1);
}
else
flexsecuritybox.DoWork();


FlexSecurityBox.h  (Winƽ̨)
#ifndef _FLEXSECURITYBOX_H
#define _FLEXSECURITYBOX_H
#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#pragma comment(lib,"ws2_32.lib")
class FlexSecurityBox
{
private:
const char * ListenAddress;
const short Port;
bool IsOpened;
SOCKET sockSrv;
SOCKET sockConn;
SOCKADDR_IN addrSrv;
public:
FlexSecurityBox(const char * listenAddress, const short port) : ListenAddress(listenAddress), Port(port), IsOpened(false)
{

}
bool Open()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 1, 1 );
err = WSAStartup( wVersionRequested, &wsaData );//³õʼ»¯Ì×½Ó×Ö
if ( err != 0 )
{
return IsOpened = false;
}
if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 )
{
WSACleanup( );
return IsOpened = false;
}
if ((sockSrv = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("Socket create error!\n");
return IsOpened = false;
}
addrSrv.sin_addr.S_un.S_addr = htonl(INADDR_ANY);
addrSrv.sin_family = AF_INET;
addrSrv.sin_port = htons(Port);
if (strcmp(ListenAddress, "0.0.0.0"))
{
struct hostent * hostname = gethostbyname(ListenAddress);
if (hostname != 0)
memcpy(&addrSrv.sin_addr.s_addr, hostname->h_addr_list[0], hostname->h_length);
}
if (bind(so


Ïà¹ØÎĵµ£º

dz̸CÓëC++µÄÉè¼ÆÓë±à³Ì·ç¸ñ£¨Ò»£©

Ò»Ö±ÏëдһЩ±È½ÏCºÍC++Éè¼ÆÓë±à³Ì·ç¸ñµÄÎÄ×Ö£¬ÕýºÃ½üÀ´¹¤×÷ÈÎÎñ²»¶à£¬Äܹ»ÓÐʱ¼äÖØÐÂÕûÀíÒ»ÏÂ×Ô¼ºËùѧµÄ¶«¶«£¬ÓÚÊDZã¾ö¶¨¿ªÊ¼Ð´Õâ¸öÌâÄ¿£¬¶øÄ¿µÄ½ö½öÖ»ÊÇ´òËãÄܾÍÕâ¸ö»°ÌâºÍ´ó¼ÒÌÖÂÛÌÖÂÛ£¬Å×שÒýÓñ¡¢Ôö³¤¸öÈ˵ļûʶ¡£
Ê×ÏÈÏë˵Ã÷һϣ¬¸öÈËÊÇC++Éè¼Æ¡¢±à³Ì·ç¸ñµÄ¼á¶¨Óµ»¤Õߣ¬ËùÒÔÎҵĹ۵ãÄÑÃâ´øÓиöÈ˵ÄÆ«ºÃ£¬Èç¹ûÄú²»ÔÞÍ ......

JavaÏà¶Ô·¾¶¶ÁÈ¡Îļþ


²»¹ÜÄãÊÇÐÂÊÖ»¹ÊÇÀÏÄñ£¬ÔÚ³ÌÐòÖжÁÈ¡×ÊÔ´Îļþ×Ü»áÓöµ½Ò»Ð©ÕÒ²»µ½ÎļþµÄÎÊÌ⣬ÕâÓëJavaµ×²ãµÄʵÏÖÓйأ¬²»ÄÜËãbug£¬Ö»Òª·½·¨µÃµ±£¬ÎÊÌ⻹ÊÇ¿ÉÒÔ½â¾öµÄ¡£
 
ÏîÄ¿µÄÎļþ¼Ð½á¹¹£º
repathtest 
©À©¤src 
©¦    ©¸©¤com 
©¦        &nb ......

java ÐòÁл¯

¶ÔÏóÐòÁл¯(Serializable)ÊÇÖ¸½«¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì£¬¶ø·´ÐòÁл¯ÔòÊǸù¾Ý×Ö½ÚÐòÁлָ´¶ÔÏóµÄ¹ý³Ì¡£
ÐòÁл¯Ò»°ãÓÃÓÚÒÔϳ¡¾°£º
1.ÓÀ¾ÃÐÔ±£´æ¶ÔÏ󣬱£´æ¶ÔÏóµÄ×Ö½ÚÐòÁе½±¾µØÎļþÖУ»
2.ͨ¹ýÐòÁл¯¶ÔÏóÔÚÍøÂçÖд«µÝ¶ÔÏó£»
3.ͨ¹ýÐòÁл¯ÔÚ½ø³Ì¼ä´«µÝ¶ÔÏó¡£
¶ÔÏóËùÊôµÄÀà±ØÐëʵÏÖSerializable»òÊÇExternalizable½Ó¿Ú ......

JAVAÁ·Ï°Ìâ


¡ñÒÑÖªÔ²µÄÃæ»ýArea=π*r*r£¬Çó°ë¾¶r¡£
import javax.swing.JOptionPane;
public class T6 {
 public static void main(String args[]) {
  String s = JOptionPane.showInputDialog("ÇëÊäÈëÔ²Ãæ»ý£º");
  double Area = Double.parseDouble(s);
  double r;
  r = Math.sqrt(Area / M ......

JAVAÀàʵÏÖÐòÁл¯µÄ·½·¨ÊÇ£¿

JavaÖÐͨ¹ýimplements SerializableÀ´ÊµÏÖ¶ÔÏóµÄÐòÁл¯¡£ÆäʵSerializable½Ó¿ÚÖв¢Ã»ÓÐÐèҪʵÏֵķ½·¨£¬×¢Ã÷ij¸öÀàimplements SerializableÖ»ÊÇΪÁ˱êʶ»ò±íÃ÷Õâ¸öÀà¿ÉÒÔ±»ÐòÁл¯¡£
       ÄÇôʲôÊÇÐòÁл¯ÄØ£¬ÐòÁл¯ÓÖÓÐʲô×÷ÓÃÄØ£¿
       Ò»¸öÀ࣬»ò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ