本文整理汇总了C++中sendf函数的典型用法代码示例。如果您正苦于以下问题:C++ sendf函数的具体用法?C++ sendf怎么用?C++ sendf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendf函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: peer
/// Accept an incoming connection
int RASocket::open(void* )
{
if (reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
sLog.outError ("RASocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
ACE_INET_Addr remote_addr;
if (peer ().get_remote_addr (remote_addr) == -1)
{
sLog.outError ("RASocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
sLog.out(LOG_RA, "Incoming connection from %s.",remote_addr.get_host_addr());
///- print Motd
sendf(sWorld.GetMotd());
sendf("\r\n");
sendf(sObjectMgr.GetMangosStringForDBCLocale(LANG_RA_USER));
return 0;
}
开发者ID:mynew4,项目名称:Core-2,代码行数:27,代码来源:RASocket.cpp
示例2: connected
static void
connected(server *s)
{
/* Server successfully connected, send IRC init messages */
connection_thread *ct = s->connecting;
if ((pthread_join(ct->tid, NULL)))
fatal("pthread_join");
if (*ct->ipstr)
newlinef(s->channel, 0, "--", "Connected to [%s]", ct->ipstr);
else
newlinef(s->channel, 0, "--", "Error determining server IP: %s", ct->error);
s->soc = ct->socket;
/* Set reconnect parameters to 0 in case this was an auto-reconnect */
s->reconnect_time = 0;
s->reconnect_delta = 0;
s->latency_time = time(NULL);
s->latency_delta = 0;
sendf(NULL, s, "NICK %s", s->nick);
sendf(NULL, s, "USER %s 8 * :%s", config.username, config.realname);
//FIXME: should the server send nick as is? compare the nick when it's received?
//or should auto_nick take a server argument and write to a buffer of NICKSIZE length?
}
开发者ID:loudambiance,项目名称:rirc,代码行数:30,代码来源:net.c
示例3: take_obj_list
void take_obj_list(struct char_data *ch,struct obj_data *o,int *amount,struct char_data *give_to)
{
char buf[MAX_STRING_LENGTH];
if (*amount<=0 && !o) return;
if (o->contains)
take_obj_list(ch,o->contains,amount,give_to);
else if (o->next_content)
take_obj_list(ch,o->next_content,amount,give_to);
else {
if (o->carried_by)
obj_from_char(o);
if (o->in_obj)
obj_from_obj(o);
*amount -= o->obj_flags.cost;
sendf(ch,"Your %s is taken.\n",o->short_description);
if (give_to)
sendf(give_to,"You take his %s.\n",o->short_description);
if (give_to) {
sprintf(buf,"FINE: %d take from %s",o->virtual,GET_NAME(ch));
slog(buf);
obj_to_char(o,give_to);
o->held_for=mystrdup(GET_NAME(ch));
} else {
sprintf(buf,"LINK: %d take from %s",o->virtual,GET_NAME(ch));
slog(buf);
extract_obj(o);
}
}
开发者ID:prealms1993,项目名称:PerilousRealms1993,代码行数:29,代码来源:reception.c
示例4: cmd_script
unsigned int cmd_script(callbackp *callbacki)
{
char *domain = CONFIG_VAL(Server, domain, callbacki->g_ape->srv);
char *script = NULL;
int alloc = 0;
APE_PARAMS_INIT();
if (domain == NULL) {
send_error(callbacki->call_user, "NO_DOMAIN", "201", callbacki->g_ape);
} else {
char *autodom;
if (strcmp(domain, "auto") == 0 && (autodom = JSTR(domain)) != NULL) {
domain = autodom;
#if 0
/* http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef0120a6d65b8a970b-pi */
struct _http_header_line *hlines;
for (hlines = callbacki->client->http.hlines; hlines != NULL; hlines = hlines->next) {
if (strcasecmp(hlines->key.val, "host") == 0) {
char *loc;
char *newdom = xmalloc(sizeof(char) * (hlines->value.len + 1));
memset(newdom, '\0', hlines->value.len + 1);
if ((loc = strrchr(hlines->value.val, '.')) != NULL) {
int i, pos = 0;
for (i = 0; i < hlines->value.len; i++, pos++) {
newdom[pos] = hlines->value.val[i];
if (newdom[pos] == ':') {
newdom[pos] = '\0';
break;
}
if (hlines->value.val[i] == '.' && &hlines->value.val[i] < loc) {
pos = -1;
}
}
newdom[pos] = '\0';
domain = newdom;
alloc = 1;
}
}
}
#endif
}
sendf(callbacki->client->fd, callbacki->g_ape, "%s<html>\n<head>\n\t<script>\n\t\tdocument.domain=\"%s\"\n\t</script>\n", HEADER_DEFAULT, domain);
if (alloc) {
free(domain);
}
JFOREACH(scripts, script) {
sendf(callbacki->client->fd, callbacki->g_ape, "\t<script type=\"text/javascript\" src=\"%s\"></script>\n", script);
}
sendbin(callbacki->client->fd, "</head>\n<body>\n</body>\n</html>", 30, 0, callbacki->g_ape);
}
开发者ID:creativeprogramming,项目名称:APE_Server,代码行数:55,代码来源:cmd.c
示例5: get_file
/* Send one file. */
static void get_file(int s, char *url)
{
/* Set www_dir to point to your web directory. */
char *www_dir = NULL;
char bufo[512];
int n, w;
const char *mime = NULL;
const char *p = url + 1;
if (*p == 0)
p = "index.html";
char *p2 = strrchr(p, '.');
if (p2) {
p2++;
if (!strcmp(p2, "html")) mime = "text/html";
else if (!strcmp(p2, "htm")) mime = "text/html";
else if (!strcmp(p2, "css")) mime = "text/css";
else if (!strcmp(p2, "txt")) mime = "text/plain";
else if (!strcmp(p2, "png")) mime = "image/png";
else if (!strcmp(p2, "jpg")) mime = "image/jpg";
else if (!strcmp(p2, "class")) mime = "application/x-java-applet";
else if (!strcmp(p2, "jar")) mime = "application/java-archive";
else if (!strcmp(p2, "pdf")) mime = "application/pdf";
else if (!strcmp(p2, "swf")) mime = "application/x-shockwave-flash";
else if (!strcmp(p2, "ico")) mime = "image/vnd.microsoft.icon";
else if (!strcmp(p2, "js")) mime = "text/javascript";
}
www_dir = getenv("www_dir");
snprintf(bufo, sizeof(bufo), "%s/%s", www_dir, p);
FILE *f = fopen(bufo, "rb");
if (!f) {
sendf(s, "HTTP/1.0 404 NOK\r\n\r\n");
return;
}
sendf(s, "HTTP/1.0 200 OK\r\n");
if (mime)
sendf(s, "Content-Type: %s\r\n\r\n", mime);
else
sendf(s, "\r\n");
while ((n = fread(bufo, 1, sizeof(bufo), f)) > 0)
if ((w = mysend(s, bufo, n)) < 0)
break;
fclose(f);
}
开发者ID:bogdanPricope,项目名称:ofp,代码行数:52,代码来源:httpd.c
示例6: cmd_script
unsigned int cmd_script(callbackp *callbacki)
{
char *domain = CONFIG_VAL(Server, domain, callbacki->g_ape->srv);
if (domain == NULL) {
send_error(callbacki->call_user, "NO_DOMAIN", "201", callbacki->g_ape);
} else {
int i;
sendf(callbacki->fdclient, callbacki->g_ape, "%s<html>\n<head>\n\t<script>\n\t\tdocument.domain=\"%s\"\n\t</script>\n", HEADER, domain);
for (i = 1; i <= callbacki->nParam; i++) {
sendf(callbacki->fdclient, callbacki->g_ape, "\t<script type=\"text/javascript\" src=\"%s\"></script>\n", callbacki->param[i]);
}
sendbin(callbacki->fdclient, "</head>\n<body>\n</body>\n</html>", 30, callbacki->g_ape);
}
return (FOR_NOTHING);
}
开发者ID:CrypticSwarm,项目名称:APE_Server,代码行数:15,代码来源:cmd.c
示例7: forwardsegToSRT
//SNP process uses this function to send a sendseg_arg_t structure which contains a segment and its src node ID to the SRT process.
//Parameter tran_conn is the TCP descriptor of the connection between the SRT process and the SNP process.
//Return 1 if a sendseg_arg_t is succefully sent, otherwise return -1.
int forwardsegToSRT(int tran_conn, int src_nodeID, seg_t* segPtr)
{
sendseg_arg_t a;
a.nodeID = src_nodeID;
memcpy(&a.seg, segPtr, sizeof(seg_t));
return sendf(&a, tran_conn);
}
开发者ID:yangxk15,项目名称:Computer-Networks,代码行数:10,代码来源:seg.c
示例8: snp_sendseg
//SRT process uses this function to send a segment and its destination node ID in a sendseg_arg_t structure to SNP process to send out.
//Parameter network_conn is the TCP descriptor of the connection between the SRT process and the SNP process.
//Return 1 if a sendseg_arg_t is succefully sent, otherwise return -1.
int snp_sendseg(int network_conn, int dest_nodeID, seg_t* segPtr)
{
sendseg_arg_t a;
a.nodeID = dest_nodeID;
memcpy(&a.seg, segPtr, sizeof(seg_t));
return sendf(&a, network_conn);
}
开发者ID:yangxk15,项目名称:Computer-Networks,代码行数:10,代码来源:seg.c
示例9: command_debug_ping
void
command_debug_ping(uint32_t *args)
{
uint8_t len = args[0];
char *data = (void*)(size_t)args[1];
sendf("pong data=%*s", len, data);
}
开发者ID:N7QWT,项目名称:klipper,代码行数:7,代码来源:debugcmds.c
示例10: command_debug_read8
void
command_debug_read8(uint32_t *args)
{
uint8_t *ptr = (void*)(size_t)args[0];
uint16_t v = *ptr;
sendf("debug_result val=%hu", v);
}
开发者ID:N7QWT,项目名称:klipper,代码行数:7,代码来源:debugcmds.c
示例11: PyErr_SetString
static PyObject *sendAuthChallenge(PyObject *self, PyObject *args)
{
//cn, domain, reqid, publicKey
//return answer to challenge
int cn;
char *domain;
uint id;
char *publicKey;
server::clientinfo *ci;
if(!PyArg_ParseTuple(args, "isIs", &cn, &domain, &id, &publicKey))
return 0;
ci = server::getinfo(cn);
if(!ci)
{
PyErr_SetString(PyExc_ValueError, "Invalid cn specified");
return 0;
}
uint seed[3] = { randomMT(), randomMT(), randomMT() };
vector<char> challengeBuf;
vector<char> answerBuf;
void *parsedKey = parsepubkey(publicKey);
genchallengestr(parsedKey, seed, sizeof(seed), challengeBuf, answerBuf);
freepubkey(parsedKey);
sendf(ci->clientnum, 1, "risis", N_AUTHCHAL, domain, id, challengeBuf.getbuf());
return Py_BuildValue("s", answerBuf.getbuf());
}
开发者ID:MorganBorman,项目名称:cxsbs,代码行数:29,代码来源:servermodule.cpp
示例12: basic_auth
int basic_auth (SOCKET s )
{
char *cred, *user = relay_user, *pass= relay_pass;
int len, ret;
char * userpass= NULL;
if (user == NULL)
{
g_error("Cannot decide username for proxy authentication.(%s,%d)",__FILE__, __LINE__);
return -1;
}
if (pass == NULL)
{
g_error("Can not decide password for proxy authentication.(%s,%d)", __FILE__, __LINE__);
}
// if ((pass = determine_relay_password ()) == NULL &&
// (pass = readpass("Enter proxy authentication password for %[email protected]%s: ",
//relay_user, relay_host)) == NULL)
// g_error("Cannot decide password for proxy authentication.");
len = strlen(user)+strlen(pass)+1;
userpass = xmalloc(len+1);
snprintf(userpass, len+1, "%s:%s", user, pass);
//memset (pass, 0, strlen(pass));
cred = make_base64_string(userpass);
memset (userpass, 0, len);
ret = sendf(s, "Proxy-Authorization: Basic %s\r\n", cred);
memset(cred, 0, strlen(cred));
free(cred);
return ret;
}
开发者ID:4179e1,项目名称:gtkqq,代码行数:34,代码来源:qqproxy.c
示例13: check_latency
static int
check_latency(server *s, time_t t)
{
/* Check time since last message */
time_t delta;
if (s->soc < 0)
return 0;
delta = t - s->latency_time;
/* Server has timed out */
if (delta > SERVER_TIMEOUT_S) {
server_disconnect(s, 1, 0, "Ping timeout (" STR(SERVER_TIMEOUT_S) ")");
return 1;
}
/* Server might be timing out, attempt to PING */
if (delta > SERVER_LATENCY_PING_S && !s->pinging) {
sendf(NULL, s, "PING :%s", s->host);
s->pinging = 1;
}
/* Server hasn't responded to PING, display latency in status */
if (delta > SERVER_LATENCY_S && ccur->server == s) {
s->latency_delta = delta;
draw(D_STATUS);
}
return 0;
}
开发者ID:loudambiance,项目名称:rirc,代码行数:32,代码来源:net.c
示例14: command_debug_read16
void
command_debug_read16(uint32_t *args)
{
uint16_t *ptr = (void*)(size_t)args[0];
irqstatus_t flag = irq_save();
uint16_t v = *ptr;
irq_restore(flag);
sendf("debug_result val=%hu", v);
}
开发者ID:N7QWT,项目名称:klipper,代码行数:9,代码来源:debugcmds.c
示例15: zappy_connect_nbr
int zappy_connect_nbr(t_fds *c, char *_)
{
t_player *p;
(void)_;
if (!c || !(p = *(t_player**)c) || !p->team)
return (false);
sendf(c, "%d", p->team->max_conn);
return (true);
}
开发者ID:Nwazette,项目名称:Zappy,代码行数:10,代码来源:connect_nbr.c
示例16: command_spi_transfer
void
command_spi_transfer(uint32_t *args)
{
uint8_t oid = args[0];
struct spidev_s *spi = oid_lookup(oid, command_config_spi);
uint8_t data_len = args[1];
uint8_t *data = (void*)(size_t)args[2];
spidev_transfer(spi, 1, data_len, data);
sendf("spi_transfer_response oid=%c response=%*s", oid, data_len, data);
}
开发者ID:KevinOConnor,项目名称:klipper,代码行数:10,代码来源:spicmds.c
示例17: command_stepper_get_position
// Report the current position of the stepper
void
command_stepper_get_position(uint32_t *args)
{
uint8_t oid = args[0];
struct stepper *s = stepper_oid_lookup(oid);
irq_disable();
uint32_t position = stepper_get_position(s);
irq_enable();
sendf("stepper_position oid=%c pos=%i", oid, position - POSITION_BIAS);
}
开发者ID:KevinOConnor,项目名称:klipper,代码行数:11,代码来源:stepper.c
示例18: sports_cast
void sports_cast(char * fmt, ...) {
va_list args;
char s[MAX_STRING_LENGTH];
struct connection_data *i;
va_start(args, fmt);
vsprintf(s, fmt, args);
va_end(args);
for (i = connection_list; i ; i = i->next)
if(!i->connected && !IS_SET(i->character->specials.act, PLR_NOSPORTS))
sendf(i->character,"SPORTS NEWS: %s\n",s);
}
开发者ID:prealms1993,项目名称:PerilousRealms1993,代码行数:12,代码来源:nlog.c
示例19: ok_to_use
bool
ok_to_use(CHAR_DATA *ch, const struct lookup_type *table, int value)
{
int minlev = level_table_lookup(table, value);
if (minlev > get_trust(ch)) {
sendf(ch, "You must be level %d to use this value.\n\r", minlev);
return FALSE;
}
return TRUE;
}
开发者ID:bramblevine,项目名称:adesa,代码行数:12,代码来源:macros.c
注:本文中的sendf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论