一个简单的linux下网络程序实例-网络编程入门 收藏
http://blog.csdn.net/manio/archive/2006/10/13/1333202.aspx
/*
server
*/
#include
<
stdio.h
>
#include
<
sys
/
types.h
>
#include
<
netinet
/
in
.h
>
#include
<
sys
/
socket.h
>
#include
<
netdb.h
>
#include
<
unistd.h
>
#include
<
string
.h
>
#include
<
arpa
/
inet.h
>
#define
PORT 8848
#define
BACKLOG 1
main()
{
int
listenfd,connectfd;
struct
sockaddr_in server;
struct
sockaddr_in client;
int
sin_size;
if
(( listenfd
=
socket(AF_INET, SOCK_STREAM,
0
))
==
-
1
)
{
perror(
"
Creating socket failed.
"
);
return
0
;
}
int
opt
=
SO_REUSEADDR;
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR,
&
opt,
sizeof
(opt));
bzero(
&
server,
sizeof
(server));
server.sin_family
=
AF_INET;
server.sin_port
=
htons(PORT);
server.sin_addr.s_addr
=
htonl(INADDR_ANY);
printf(
"
binding...
"
);
if
(bind(listenfd, (
struct
sockaddr
*
)
&
server,
sizeof
(
struct
sockaddr))
==
-
1
) {
perror(
"
Bind error
"
);
ret
相关文档:
linux 中文显示乱码解决办法
vi /etc/sysconfig/i18n
将内容改为
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"
这样中文在SSH,telnet终端就可以正常显示
......
linux操作系统下system () 函数详解
(执行shell 命令)
相关函数
fork,execve,waitpid,popen
表头文件
#include<stdlib.h>
定义函数
int system(const char * string);
函数说明
system()会调用fork()产生子进程,由子进程来调用/bin/sh-c string来执行参数string ......
在Linux下使用Gtk+实现最简单的GUI窗口,源代码如下:
//SimpleGui.c
#include <gtk/gtk.h>
int main(int argc,char *argv[])
{
//定义一个widget(Gtk+构件),这里定义的是一个窗口构件
GtkWidget *wnd;
//Gtk+2.0的初始化命令行参数,每一个Gtk+程序都要有这句话
gtk_init(& ......
package: download from:
软件集成开发环境(代码编辑、浏览、编译、调试)
Emacs http://www.gnu.org/software/emacs/
Source-Navigator 5.2b2 http://sourceforge.net/projects/sourcenav
Anjuta http://anjuta.sourceforge.net(可用yum安装)
代码索引工具
Cscope http://cscope.sourceforge.net/
KScope http:/ ......
作者:lch
matlab
for
Linux
安装
(
安装方法文档是从网上查资料+
实践得到的 )
一.
安装
1.
首先需要建立安装目录
[wzh@localhost ~]$ su
[root@localhost ~]$ mkdir /usr/matlab
2.
然后加载光盘映像
[root@localhost wzh]# mount -o loop -t iso9660
/mnt/hda7 ......