Socket programming in C on Linux | tutorial
摘要:TCP/IP socket programmingThis is a quick guide/tutorial to learning socket programming in C language on a Linux system. "Linux" because the code snippets shown over here will work only on a Linux system and not on Windows. Thewindows api to socket programmingis called winsock and we shall
阅读全文
posted @
2013-07-26 15:01
Daniel.G
阅读(7306)
推荐(0)
C Socket Programming for Linux with a Server and Client Example Code
摘要:Typically two processes communicate with each other on a single system through one of the following inter process communication techniques.PipesMessage queuesShared memoryThere are several other methods. But the above are some of the very classic ways of interprocess communication.But have you ever
阅读全文
posted @
2013-07-26 14:51
Daniel.G
阅读(1311)
推荐(0)
UDP protocol
摘要:Characteristics of the UDP protocolThe UDP protocol (User Datagram Protocol) is a connectionless orientated protocol of thetransport layerof theTCP/IPmodel. This protocol is very simple given that it does not provide error detection (it is not connection orientated...).The UDP segment header is ther
阅读全文
posted @
2013-07-26 09:30
Daniel.G
阅读(472)
推荐(0)
TCP protocol
摘要:he characteristics of TCP protocolTCP(which meansTransmission Control Protocol) is one of the main protocols of the transport layer of theTCP/IPmodel. It makes it possible, at application level, to manage data coming from (or going to) the lower layer of the model (i.e. theIPprotocol). When data is
阅读全文
posted @
2013-07-26 09:29
Daniel.G
阅读(834)
推荐(0)
How to learn linux device driver
摘要:To learn device driver development, like any other new knowledge, the bestapproachfor me is to learn first thetheoryand then to do somepractice.If you don't know about operating systems, Irecommend"Willam Stalling's OS book" [1]. This book has a more hardwareorientedapproach unlike
阅读全文
posted @
2013-07-25 17:31
Daniel.G
阅读(832)
推荐(0)
在Linux中创建静态库和动态库
摘要:我们通常把一些公用函数制作成函数库,供其它程序使用。函数库分为静态库和动态库两种。静态库在程序编译时会被连接到目标代码中,程序运行时将不再需要该静态库。动态库在程序编译时并不会被连接到目标代码中,而是在程序运行是才被载入,因此在程序运行时还需要动态库存在。本文主要通过举例来说明在Linux中如何创建静态库和动态库,以及使用它们。在创建函数库前,我们先来准备举例用的源程序,并将函数库的源程序编译成.o文件。第1步:编辑得到举例的程序--hello.h、hello.c和main.c;hello.h(见程序1)为该函数库的头文件。hello.c(见程序2)是函数库的源程序,其中包含公用函数hello
阅读全文
posted @
2013-07-14 23:34
Daniel.G
阅读(256)
推荐(0)
详细讲解 关于Linux静态库和动态库的分析
摘要:基本概念库有动态与静态两种,动态通常用.so为后缀,静态用.a为后缀。例如:libhello.so libhello.a 为了在同一系统中使用不同版本的库,可以在库文件名后加上版本号为后缀,例如: libhello.so.1.0,由于程序连接默认以.so为文件后缀名。所以为了使用这些库,通常使用建立符号连接的方式。ln -s libhello.so.1.0 libhello.so.1ln -s libhello.so.1 libhello.so1、使用库当要使用静态的程序库时,连接器会找出程序所需的函数,然后将它们拷贝到执行文件,由于这种拷贝是完整的,所以一旦连接成功,静态程序库也就不再需要了
阅读全文
posted @
2013-07-14 23:26
Daniel.G
阅读(541)
推荐(0)
linux下的共享库(动态库)和静态库
摘要:1.什么是库在windows平台和linux平台下都大量存在着库。本质上来说库是一种可执行代码的二进制形式,可以被操作系统载入内存执行。由于windows和linux的本质不同,因此二者库的二进制是不兼容的。本文仅限于介绍linux下的库。2.库的种类linux下的库有两种:静态库和共享库(动态库)。二者的不同点在于代码被载入的时刻不同。静态库的代码在编译过程中已经被载入可执行程序,因此体积较大。共享库的代码是在可执行程序运行时才载入内存的,在编译过程中仅简单的引用,因此代码体积较小。3.库存在的意义库是别人写好的现有的,成熟的,可以复用的代码,你可以使用但要记得遵守许可协议。现实中每个程序都
阅读全文
posted @
2013-07-14 23:25
Daniel.G
阅读(1109)
推荐(0)
原子性
摘要:原子性这个概念初想是非常简单的。它表示一个操作序列就像一个操作一样不被打断,而不像一个操作序列一样中间容许被打断。但是细想下来还是挺有点意思的。首先需要确定的就是什么是一个操作?而什么不是一个操作却是一个操作序列?其次需要确定的是如何叫做像?怎么着就是不像了?另外,还有一个牵扯进来的概念就是原子性的范围和其在什么程度上实施这种保证。或许我这儿说的有点形而上,那我们就形而下的举出例子抓住原子性这个概念的直观感觉。 先举一个CPU指令集中常见的一个指令:CAS。看到这个指令我就仿佛看到了大家脸上的某种意味的笑容。呵呵,是的,它完成两个操作,一个比较,一个交换,后一个完不完成依赖于前一个操作的...
阅读全文
posted @
2013-07-14 23:09
Daniel.G
阅读(631)
推荐(0)
TCP-心跳
摘要:心跳包就是在客户端和服务器间定时通知对方自己状态的一个自己定义的命令字,按照一定的时间间隔发送,类似于心跳,所以叫做心跳包。 用来判断对方(设备,进程或其它网元)是否正常运行,采用定时发送简单的通讯包,如果在指定时间段内未收到对方响应,则判断对方已经离线。用于检测TCP的异常断开。基本原因是服务器端不能有效的判断客户端是否在线,也就是说,服务器无法区分客户端是长时间在空闲,还是已经掉线的情况。所谓的心跳包就是客户端定时发送简单的信息给服务器端告诉它我还在而已。代码就是每隔几分钟发送一个固定信息给服务端,服务端收到后回复一个固定信息如果服务端几分钟内没有收到客户端信息则视客户端断开。 比如有..
阅读全文
posted @
2013-07-09 10:22
Daniel.G
阅读(4309)
推荐(0)