SetConnectionProperty

ホスト名、タイアウト時間など、サーバー接続設定プロパティを設定します。

構文

ASCII バージョン
int setConnectionProperty(Server* server, const char* name, const char* value) 
Unicode バージョン
int setConnectionProperty(Server* server, const UChar* name, const UChar* value) 

パラメータ

  • Server — クライアントが接続するサーバー。
  • Name — 接続プロパティの名前。HOST など。
  • Value — 接続プロパティの値。"www.myhost.com" など。

結果

0 (正常終了) またはエラー コードを返します。

ASCII バージョン
int nRet; 
Server *server = NULL; 
nRet = createServer(&server); 
nRet = setConnectionProperty(server, SERVER_HOST, 
"localhost");
Unicode バージョン
int nRet; 
// construct 16-bit string 
UChar serverHost[32]; 
char* SERVER_HOST= SERVER_HOST; 
u_charsToUChars(SERVER_HOST,	serverHost,	strlen(SERVER_HOST)); 
serverHost [ strlen(SERVER_HOST)]=0;	
// construct 16-bit string 
UChar hostValue [32]; 
char* value= "localhost"; 
u_charsToUChars(value,	hostValue,	strlen(value)); 
hostValue[ strlen(value)]=0;	
nRet = setConnectionProperty(server, serverHost	, hostValue);