09 2012 档案
摘要:I remember I typed "./client localhost &./client localhost & ...." for repeating over 500+ times , in testing some network program. And when I met some kind of stuck in the program, I got the errorResource temporarily unavailable, then can't start more client to test.Even more,
阅读全文
摘要:During the time I use standalone cross compliers to build my system, I find there is NO pthread_cancel in pthread.h (/home/dengwei/standalone-toolchain/sysroot/usr/include/pthread.h).Shocked by that, but here comes the solution, by using pthread_kill to send a signal , and adding a signal handler :#
阅读全文
摘要:I try to build my program without jni ndk-build , but by a standalne arm-kind cross compliers way . However ,after I write a simple sample , using STL and thread function with my own Makefile , and I do make command,I encount all kind of weird program . error 0: in a dynamic library way [den...
阅读全文
摘要:first : download arm cross compliers next : modify env [dengwei@localhost ~]$ vi ~/.bashrc export PATH="/home/dengwei/arm-marvell-linux-gnueabi/bin:$PATH" third: code here #include<stdio.h> #include<stdlib.h> #include<string.h> intmain(in...
阅读全文
摘要:where this article from First, two big things--the main function and how to compile it, followed by lots of little differences.main functionC++// free-floating function int main( int argc, char* argv[]) { printf( "Hello, world" ); } Java// every function must be part of a class; the main f
阅读全文
摘要:There are example about how Android platform call c code via NDK , which are inandroid-ndk-r8(version) dirctory :/home/dengwei/android-NDK/samples[dengwei@localhost samples]$ lsbitmap-plasma hello-jni hello-neon native-activity native-media san-angeles two-libshello-gl2 module-exports nativ...
阅读全文
摘要:1、安装CDT 单独安装 CDT, 下载了个cdt-master-8.1.0.zip , 结果发现是 eclipse Juno version 的, 我使用的是Eclipse Helios Version: 3.6.2 , 应该下载 cdt-master-7.0.2.zip 加载cdt-master-7.0.2.zip 后,报错: Cannotcompletetheinstallbecauseoneormorerequireditemscouldnotbefound. Softwarebeinginstalled:C/C++...
阅读全文
摘要:chat_server.cppchat_server.cpp#include"chat.h"externintsock_server_init(int&listenfd,uint16_tserver_port);voiderr_quit(constchar*error_string){printf("%s\n",error_string);exit(1);}voiderr_sys(constchar*error_string){printf("%s\n",error_string);}externssize_tp_read_f
阅读全文
摘要:some of the codes are the same with previous article. I just list the different code here .chat_server.cppView Code#include"chat.h"externintsock_server_init(int&listenfd,uint16_tserver_port);voiderr_quit(constchar*error_string){printf("%s\n",error_string);exit(1);}voiderr_sys
阅读全文
摘要:we'll create a concurrent server program with some kind of message handling functions.But first, let's look at some easy example. Then step by step , we create more and more complex programs. chat.h#ifndef__CHAT_H#define__CHAT_H#include<stdlib.h>#include<unistd.h>#include<neti
阅读全文
摘要:#include<sys/types.h>/*basicsystemdatatypes*/#include<sys/socket.h>/*basicsocketdefinitions*/#ifTIME_WITH_SYS_TIME#include<sys/time.h>/*timeval{}forselect()*/#include<time.h>/*timespec{}forpselect()*/#else#ifHAVE_SYS_TIME_H#include<sys/time.h>/*includes<time.h>uns
阅读全文