// Draws a box and fills it in with the given color void drawBoxFill(char x, char y, char height, char width, int color) { char Hig = 0; char Low = color & 0x00ff; int i = 0; int j = 0; Hig = color >> 8; sendcomand(ST7735_CASET); // Column addr set senddata(0x00); senddata(x); // XSTART senddata(0x00); senddata(x + width); // XEND sendcomand(ST7735_RASET); // Row addr set senddata(0x00); senddata(y); // YSTART senddata(0x00); senddata(y + height); // YEND sendcomand(ST7735_RAMWR); for (j = 0; j <= width; j++) { for (i = 0; i <= height; i++) { senddata(Low); senddata(Hig); } } }
bool DVR::updateChannels() { TDVRPacket pk; int res; pk.setCmd(0x11); pk.setExtLen(16); for (size_t i = 0; i < m_conns.size(); i++) pk.raw[8 + m_conns[i].channel] = 1; // 1-yes, 0-no res = senddata(m_controlFd, pk.raw, 32); if (res == -1) { setError(ConnectionError, getErrorText("unable to send channel start packet")); return false; } uint8_t extdata[16]; memset(extdata, 0, 16); // if 1, only thumbnails are being sent for (size_t i = 0; i < m_conns.size(); i++) extdata[m_conns[i].channel] = 0; res = senddata(m_controlFd, extdata, 16); if (res == -1) { setError(ConnectionError, getErrorText("unable to send channel start extdata")); return false; } return true; }
//////////////////////////////////////////////////// //////////////////////////////////////////////////// ///////6 bytes each time before sending to the server to send all need//////////////// char send_head(char *cmd,unsigned int body_len) { unsigned char body_len1; unsigned char body_len2; body_len1=body_len/256; body_len2=body_len%256; //Packg inpackg 6 byte; if ((sendbytes = senddata(ssl,sockfd,"00",sizeof("00")-1)) == -1) { perror("send head"); exit(1); }//perror("send"); if ((sendbytes = senddata(ssl,sockfd,cmd,strlen(cmd))) == -1) { perror("send"); exit(1); }//perror("send cmd"); //DEBUG_printf("sizeof(cmd)=%d\n",strlen(cmd)); if ((sendbytes = senddata(ssl,sockfd,&body_len1, sizeof(char))) == -1) { perror("send"); exit(1); } if ((sendbytes = senddata(ssl,sockfd,&body_len2, sizeof(char))) == -1) { perror("send"); exit(1); } return 1; }
/*DISPATCHER_UIPCALL(smtp_appcall, state)*/ void smtp_appcall(void *state) { if(uip_connected()) { /* senddata();*/ return; } if(uip_acked()) { acked(); } if(uip_newdata()) { newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { senddata(); } /* if(uip_closed()) { printf("Dnoe\n"); }*/ }
void* sock_consume(void *arg){ // NOTE: arg will be a pointer to the linked list of available sockets. int newsock = 0; linkedlist* socks = (linkedlist*)(arg); while(still_running){ pthread_mutex_lock(socks->listlock); while((socks->tail)->socket == -1){ pthread_cond_wait(socks->listempty, socks->listlock); } newsock = list_remove(&socks->head); pthread_mutex_unlock(socks->listlock); char* buffer = malloc(sizeof(char)*1024); if(getrequest(newsock,buffer,1024)==0){ char* filename = malloc(sizeof(char)*strlen(buffer)); if(buffer[0] == '/') { strcpy(filename, (const char*)(buffer + 1)); printf("_%s_\n_%s_\n",buffer, filename); } else{ strcpy(filename, (const char*)(buffer)); } char * request = NULL; //What is going to be passed to sendata (either the 200 or 404) struct stat *finfo = malloc(sizeof(struct stat)); if(0 == stat((const char*)filename, finfo)){ int size = (int)(finfo->st_size); //Fill request with the HTTP header. char* header = malloc(sizeof(int)*(strlen(HTTP_200))); sprintf(header, HTTP_200, size); int reqsize = sizeof(int)*strlen(header) + size; request = malloc(reqsize); strcpy(request,(const char*) header); int reqpos = strlen(header); //Fill the rest of request with things from the file. int fdesc = open((const char*) filename, O_SYNC); char* buf = malloc(sizeof(char)*1024); int moredata = read(fdesc, (void*)buf, 1024); for(; moredata>0; moredata = read(fdesc, (void*)buf, 1024)){ strncpy(request+reqpos, (const char*) buf, moredata); reqpos+=moredata; } request[reqpos] = '\0'; senddata(newsock, (const char*) request, reqsize); close(fdesc); free(header); }else{ request = malloc(sizeof(char)*strlen(HTTP_404)); strcpy(request, (const char*)(HTTP_404)); senddata(newsock, (const char*) request, strlen(request)); } //Do the logging of stuff to the file. free(request); free(finfo); free(filename); } free(buffer); } return NULL; }
// Cleans the entire screen as a certain color void clean(int color) { char Hig = 0; int x = 0; int y = 0; char Low = color & 0x00ff; color >>= 8; Hig = color; sendcomand(ST7735_CASET); // Column addr set senddata(0x00); senddata(0); // XSTART senddata(0x00); senddata(V); // XEND sendcomand(ST7735_RASET); // Row addr set senddata(0x00); senddata(0); // YSTART senddata(0x00); senddata(H); // YEND sendcomand(ST7735_RAMWR); for (x = 0; x < V; x++) { for (y = 0; y < H; y++) { senddata(Low); senddata(Hig); } } }
int server::download(char *buf){ char attnam[10],temp[10]; char data[Max_buf-40];//读取附件 char sendbuf[Max_buf];//待发送内容 int i; FILE *fatta; i=0; sscanf(buf,"%s%s",temp,attnam);//获取附件名 fatta=fopen(attnam,"r"); if(fatta==NULL){ //处理未找到 strcpy_s(sendbuf,"Attach\n\0"); strcat_s(sendbuf,"Not found!!!\n\0"); senddata(sendbuf); return 0; } strcpy_s(sendbuf,"Contents\n\0"); //strcat_s(sendbuf,attnam); //strcat_s(sendbuf,"\n\0"); while (!feof(fatta)) data[i++]=fgetc(fatta); //读取附件内容 i--; data[i]='\0'; fclose(fatta); strcat_s(sendbuf,data); senddata(sendbuf); return 0; }
/*-----------------------------------------------------------------------------------*/ void webclient_appcall(void) { if(uip_connected()) { s.timer = 0; s.state = WEBCLIENT_STATE_STATUSLINE; senddata(); webclient_connected(); return; } if(s.state == WEBCLIENT_STATE_CLOSE) { webclient_closed(); uip_abort(); return; } if(uip_aborted()) { webclient_aborted(); } if(uip_timedout()) { webclient_timedout(); } if(uip_acked()) { s.timer = 0; acked(); } if(uip_newdata()) { s.timer = 0; newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { ++s.timer; if(s.timer == WEBCLIENT_TIMEOUT) { webclient_timedout(); uip_abort(); return; } /* senddata();*/ } if(uip_closed()) { if(s.httpflag != HTTPFLAG_MOVED) { /* Send NULL data to signal EOF. */ webclient_datahandler(NULL, 0); } else { if(resolv_lookup(s.host) == NULL) { resolv_query(s.host); } webclient_get(s.host, s.port, s.file); } } }
int mc_store(mcContext *c, const item_data *item, int need_response, const char *store_type) { int ret; char cmd[512] = {'\0'}; u_char *data = item->_buffer ; size_t data_len = item->_size; if ((data_len > MCCLI_MAX_VALUESIZE) || (data_len <= 0)) { //value size overflowing return MEM_SYSTEM_ERROR; } //socket send/recv failed count over, reconnect if (c->maxsrtimes <= c->srtimes) { if (MCCLI_OK != mc_reconnect(c)) { //socket reconnect failed count over if (c->maxrctimes <= c->rctimes) { if (MCCLI_OK != changetoslv(c)) { //change mc-server failed, continue connect to old server return MEM_SYSTEM_ERROR; } } } } if (!(c->fd)) { return MEM_SYSTEM_ERROR; } if (need_response == 0) { sprintf(cmd, "%s %s %d %lu %lu noreply\r\n", store_type, item->_key, item->_flag, item->_expire, data_len); } else { sprintf(cmd, "%s %s %d %lu %lu\r\n", store_type, item->_key, item->_flag, item->_expire, data_len); } if (MCCLI_OK != senddata(c, cmd, (int)strlen(cmd))) { __mcErrorErrorno(c, "send cmd"); return MEM_SYSTEM_ERROR; } if (MCCLI_OK != senddata(c, (char *)data, data_len)) { __mcErrorErrorno(c, "send datalen"); return MEM_SYSTEM_ERROR; } if (MCCLI_OK != senddata(c, "\r\n", 2)) { __mcErrorErrorno(c, "send \\r\\n"); return MEM_SYSTEM_ERROR; } if (need_response != 0) { ret = get_reply(c, 0); } else { ret = MEM_NO_RESPONSE; } return ret; }
/****************************************************************************** * void exosite_appcall(void) * * This function is uIP's application function. It is called whenever a uIP * event occurs (e.g. when a new connection is established, new data arrives, * sent data is acknowledged, data needs to be retransmitted, etc.). * ******************************************************************************/ void exosite_appcall(void) { if(uip_connected()) { s.timer = 0; senddata(); return; } if(s.state == EXO_STATE_CLOSE) { uip_abort(); return; } if(uip_aborted()) { } if(uip_timedout()) { } if(uip_acked()) { s.timer = 0; acked(); } if(uip_newdata()) { s.timer = 0; newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { ++s.timer; if(s.timer == EXO_TIMEOUT) { uip_abort(); return; } } #if 0 if(uip_closed()) { if(s.httpflag != HTTPFLAG_MOVED) { memset(s.rxdata,0,sizeof(s.rxdata)); } else { if(resolv_lookup(s.host) == NULL) { resolv_query(s.host); } } } #endif }
static bool sendfile(int sock, long partition_id, FILE *f) { fseek(f, 0, SEEK_END); long filesize = ftell(f); rewind(f); if (filesize == EOF) return false; if (!sendlong(sock, filesize)) return false; if (!sendlong(sock, filesize)) return false; if (filesize > 0) { char buffer[1024]; do { size_t num = min(filesize, sizeof(buffer)); num = fread(buffer, 1, num, f); if (num < 1) return false; if (!senddata(sock, buffer, num, 0)) return false; filesize -= num; } while (filesize > 0); } return true; }
int sendfile(int sock, FILE *f) { // calculate file size fseek(f, 0, SEEK_END); long filesize = ftell(f); rewind(f); if (filesize == EOF) return 0; if (sendlong(sock, filesize) == 0) return 0; // send file using a buffer length of 1024 bytes if (filesize > 0) { char buffer[1024]; do { size_t num = min(filesize, sizeof(buffer)); num = fread(buffer, 1, num, f); if (num < 1) return 0; if (senddata(sock, buffer, num) == 0) return 0; filesize -= num; } while (filesize > 0); } return 1; }
/*---------------------------------------------------------------------------*/ void telnetd_appcall(void *ts) { if(uip_connected()) { tcp_markconn(uip_conn, &s); buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; shell_start(); } if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { closed(); } if(uip_acked()) { acked(); } if(uip_newdata()) { newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); } }
void initkey() { P1=0xFF; delay1ms(25); senddata(0xA4); cls=1; }
int main(int argc, char** argv) { int socket; int rc; uint16_t msg_size = MAX_MSGSIZE; char buffer[MAX_MSGSIZE + 1]; char msg[MAX_MSGSIZE + 1]; #ifdef _WIN32 WSADATA wsaData; rc = WSAStartup(MAKEWORD(2,2), &wsaData); if (rc != 0) { printf("WSAStartup failed with error: %d\n", rc); goto err; } #endif ProcessArgs(argc, argv); memset(buffer, 0, MAX_MSGSIZE + 1); memset(msg, 0, MAX_MSGSIZE + 1); strcpy(msg, "Hello, this is the client!"); if (bIsServer) { socket = announce(OPTRC_FILE); if (socket == INVALID_SOCKET) { rc = -1; goto err; } rc = recvdata(socket, buffer, &msg_size); if (rc == SOCKET_ERROR) { goto err; } printf("%s\n", buffer); } else { socket = locate(OPTRC_FILE); if (socket == INVALID_SOCKET) { rc = -1; goto err; } rc = senddata(socket, msg, strlen(msg)); if (rc == SOCKET_ERROR) { goto err; } } err: #ifdef _WIN32 closesocket(socket); WSACleanup(); #else close(socket); #endif return rc; }
void send_connect_auth(char *cmd) { char *total_packg=NULL; char *userid; char *mac_data; char *ip_data; char ip_temp[40]; char *cuniqid; char uid_tmp[60]; char type[10]; unsigned char authbody_size; memset(uid_tmp,0,sizeof(char)*60); memset(type,0,sizeof(char)*10); memset(ip_temp,0,sizeof(char)*40); cuniqid= (char*)calloc(10,sizeof(char)); mac_data=(char*)calloc(30,sizeof(char)); ip_data=(char*)calloc(25,sizeof(char)); userid=(char*)calloc(60,sizeof(char)); if(!get_ip(ETH,ip_temp)) { DEBUG_printf("get ip error!\n"); } sprintf(ip_data,"IP=%s,",ip_temp); strcpy( userid,"UID="); #ifdef BB_BLACK strcat( userid,read_conf_by_type(bb_black_conf_dir,"api-uid",uid_tmp)); #endif // BB_BLACK #ifdef OPENWRT strcat( userid,read_luci_conf("user_id")); #endif // OPENWRT strcat( userid,","); sprintf(type,"TYPE=%d",MINERTYPE); authbody_size=strlen(gen_cuniqid(deal_package_cmd.pkg_nonce))+strlen(get_mac(mac_data,ETH))+strlen(ip_data)+strlen(userid)+strlen(type); send_head(cmd,authbody_size); total_packg=(char*)calloc((authbody_size+4),sizeof(char)); strcpy(total_packg,deal_package_cmd.pkg_nonce); strcat(total_packg,mac_data); strcat(total_packg,ip_data); strcat(total_packg,userid); strcat(total_packg,type); if ((sendbytes = senddata(ssl,sockfd,total_packg,authbody_size)) == -1) { perror("send"); //exit(1); } DEBUG_printf("send pakge str :%s\n",total_packg); free(mac_data); free(ip_data); free(userid); free(cuniqid); if(total_packg) free(total_packg); }
/*-----------------------------------------------------------------------------------*/ void telnet_app(void *ts) { struct telnet_state *s = (struct telnet_state *)ts; if(uip_connected()) { s->flags = 0; telnet_connected(s); senddata(s); return; } if(uip_closed()) { telnet_closed(s); } if(uip_aborted()) { telnet_aborted(s); } if(uip_timedout()) { telnet_timedout(s); } if(s->flags & FLAG_CLOSE) { uip_close(); return; } if(s->flags & FLAG_ABORT) { uip_abort(); return; } if(uip_acked()) { acked(s); } if(uip_newdata()) { telnet_newdata(s, (char *)uip_appdata, uip_datalen()); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(s); } else if(uip_poll()) { senddata(s); } }
void __fastcall TmForm::rgbPositionChangeFinished(TObject *Sender) { H->Position = 0; S->Position = 0; V->Position = 0; state = 0; senddata(); }
void end_request_handler(struct mg_connection *conn, int status_code) { print_request_info(conn); sem_wait(&mutex); balance --; sem_post(&mutex); printf("blance = [%d]\n", balance); senddata(tcp_h, balance); }
void __fastcall TmForm::hsvPositionChangeFinished(TObject *Sender) { R->Position = 0; G->Position = 0; B->Position = 0; state = 1; senddata(); }
int main(int argc, char *argv[]) { // default to localhost char *server_name= "localhost"; unsigned short port = DEFAULT_PORT; int i, loopcount, maxloop=-1; int retval; unsigned int addr; int socket_type = DEFAULT_PROTO; struct sockaddr_in server; if (argc < 3) { Usage(); } if ((retval = WSAStartup(0x202, &wsaData)) != 0) { fprintf(stderr,"WSAStartup() failed with error %d\n", retval); WSACleanup(); return -1; } // Get portnum port = atoi(argv[2]); memset(&server, 0, sizeof(server)); server.sin_addr.s_addr = inet_addr(argv[1]); server.sin_family = AF_INET; server.sin_port = htons(port); conn_socket = socket(AF_INET, socket_type, 0); /* Open a socket */ if (conn_socket <0 ) { fprintf(stderr,"Client: Error Opening socket: Error %d\n", WSAGetLastError()); WSACleanup(); return -1; } if (connect(conn_socket, (struct sockaddr*)&server, sizeof(server)) == SOCKET_ERROR) { fprintf(stderr,"Client: connect() failed: %d\n", WSAGetLastError()); WSACleanup(); return -1; } // Send the data senddata(); // recieve a msg recvdata(); closesocket(conn_socket); WSACleanup(); return 0; }
/*---------------------------------------------------------------------------*/ void telnetd_appcall(void *ts) { if(uip_connected()) { if(!connected) { buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; connected = 1; shell_start(); timer_set(&s.silence_timer, MAX_SILENCE_TIME); ts = (char *)0; } else { uip_send(telnetd_reject_text, strlen(telnetd_reject_text)); ts = (char *)1; } tcp_markconn(uip_conn, ts); } if(!ts) { if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { shell_stop(); connected = 0; } if(uip_acked()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); acked(); } if(uip_newdata()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); if(s.numsent > 0) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); } } if(uip_poll()) { if(timer_expired(&s.silence_timer)) { uip_close(); tcp_markconn(uip_conn, NULL); } } } }
void data_connect(char *addr, char *pasv, int bool) { int port,i; static char buf[65559]; close(s2); port = data_port(pasv,addr); a2.sin_port = htons(port); a2.sin_family = AF_INET; a2.sin_addr.s_addr = inet_addr(addr); s2 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); connect(s2,(struct sockaddr*)&a2,sizeof(a2)); if(!bool){ senddata(s1,"STOR kf\n",2); for(i=0;i<65558;i++)buf[i]=0x0a; buf[i]=0; senddata(s2,buf,3); close(s2); } else{
int begin_request_handler(struct mg_connection *conn) { print_request_info(conn); sem_wait(&mutex); balance ++; sem_post(&mutex); printf("blance = [%d]\n", balance); senddata(tcp_h, balance); return 0; }
/** * Function: processSerialClientUdpConnection * Description: 串口客户端建立UDP连接的接口函数,需要建立UDP连接时该函数将被调用,函数通过调用serialClientUdpConnect * 函数来创建UDP连接,之后调用数据发送函数。最后关闭UDP连接 * @param host 连接的远程主机IP地址 * @param port 远程主机的端口号 * @param serial_index 该连接对应的串口号 **/ void processSerialClientUdpConnection(char *host, uint16_t port,uint8_t serial_index) { struct udp_pcb *serial_udp; int send_length; serial_udp = serialClientUdpConnect(host,port,serial_index); send_length = handleSerialClientUdpOutput(serial_index); if(send_length > 0){ senddata(serial_udp,serial_index,send_length); //printf("serial data send over\n\r"); } udp_remove(serial_udp); }
void service(char *buffer, int clientsocket) { FILE *fp; char *url, *protocol, *parsedurl; int redirect,i; url=getNextparameter(buffer); protocol=getNextparameter(url); redirect = parseurl(url,&parsedurl); if(redirect) { senddata(url,clientsocket,redirect); printf("\nURL:%s\n",url); } else { senddata(parsedurl,clientsocket,redirect); printf("\nURL:%s\n",parsedurl); } }
bool DVR::login(const string& username, const string& pass) { TDVRPacket pk; int res; char user_pass[20]; sprintf(user_pass, "%s&&%s", username.c_str(), pass.c_str()); strncpy((char*)&pk.raw[8], username.c_str(), 8); strncpy((char*)&pk.raw[16], pass.c_str(), 8); pk.setCmd(0xa0); //pk.raw[3] = 0x60; pk.raw[24] = 0x04; pk.raw[25] = 0x01; //pk.raw[30] = 0xa1; //pk.raw[31] = 0xaa; //pk.setExtLen (strlen (user_pass)); res = senddata(m_controlFd, pk.raw, 32); if (res == -1) { setError(ConnectionError, getErrorText("unable to send login request packet")); return false; } res = readdata(m_controlFd, pk.raw, 32); if (res == -1) { setError(ConnectionError, getErrorText("unable to read login response packet")); return false; } if (pk.getCmd() != 0xb0) { setError(ConnectionError, "invalid login response"); return false; } res = pk.raw[8]; if (res != 0) { int code = pk.raw[9]; char buf[200]; sprintf(buf, "channel request error - res: %d code: %d", res, code); setError(LoginError, buf); return false; } m_connId = *(uint32_t*)(pk.raw + 16); return true; }
int main(int argc, char** argv) { fd = open("/dev/usb/lp0", O_RDWR | O_NONBLOCK); write_command_packet(0xa1, 0xa1, 0, 2); idle(5); /* return 0;*/ write_command_packet(0xa0, 0xa2, 0, 1); write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa1, 0xa0, 0, 2); write_command_packet(0xa4, 0xe0, 0, 1); { unsigned char buf[] = {0xee, 0xdb, 0xea, 0xad, 0x00, 0x00, 0x00, 0x00}; write_command_packet_buf(0xa5, 0xe0, 0, 1, (unsigned char*)&buf, 8); } write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa0, 0xa0, 0, 2); write_command_packet(0xa1, 0xa0, 0, 2); write_command_packet(0xa0, 0xe0, 0, 1); { unsigned char buf[] = { 0x00, 0x00, 0xa4, 0x01, 0x02, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x11, 0x03, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, 0x78, 0x00, 0x50, 0x02, 0x7a, 0x1a, 0x60, 0x13, 0x67, 0x1b}; write_command_packet_buf(0xa0, 0xd0, 0, 0, (unsigned char*)&buf, 34); } write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa1, 0xd0, 0, 0); write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa0, 0xa0, 0, 2); senddata(); write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa2, 0xd0, 0, 0); write_command_packet(0xa0, 0xe0, 0, 1); write_command_packet(0xa1, 0xa0, 0, 2); wait(WAIT); idle(5); close(fd); return 0; }
void gaudio_play_lld_start(void) { WAVEHDR *pwh; isRunning = TRUE; while (nQueuedBuffers < MAX_WAVE_HEADERS) { // Find the empty one - there will always be at least one. for(pwh = WaveHdrs; pwh->lpData; pwh++); // Grab the next audio block from the Audio Out Queue if (!senddata(pwh)) break; } }
//////////////////////////////////////////////////// ////////////Send CONNECT_CC///////////////////////// int send_connect_cc(char *cmd) { int revbody_size=strlen(buf); DEBUG_printf("02revbody_size=%d\n",revbody_size); send_head(cmd,revbody_size); if ((sendbytes = senddata(ssl,sockfd,buf, revbody_size)) == -1) { perror("send"); exit(1); } DEBUG_printf("send what I rev:\n%s\n",buf); return 1; }