Summary after setting up a Debian programming environment and developing a simple socket program

Source: Internet
Author: User
After setting up a Debian programming environment and developing a simple socket program, we will summarize the Linux Release Technology-Debian information. The following is a detailed description. 1. Debian installation is time-consuming and reinstalled many times due to lack of experience.

After three Debian systems are installed, the first time the disk space is insufficient, the system fails to be installed successfully. The second time, the default Debian settings are selected, and a page with a UI is installed. The third time, the "desk top" option is removed, debian without interface is installed.

2. Due to limited understanding of linux, sometimes I have to reinstall it.

After Debian is installed, you cannot connect to the network. You have modified the IP addresses, gateways, and dns in the/etc/network/interfaces file, but still cannot. It is suspected that the network is not successfully configured automatically during installation. After the system is re-installed, select manual configuration in the network configuration area. After installation, the network can be connected.

3. Install common software and commands

3.1 install the gcc command

Download a gcc installation file from the Internet, but follow the prompts it shows that the installation is always unsuccessful and the c compiler cannot be found. Finally, there is no way to use a method with limitations: the network status apt-get install gcc

3.2 install other Common commands

Install the ssh command apt-get install ssh
Install the make command apt-get install make
Install bzip2 command apt-get install bzip2 // used to decompress the. bz2 File
...

4. ip addresses, gateways, and other information are stored in the/etc/network/interfaces file in the following format:

Allow-hotplug eth0
Iface eth0 inet static
Address 192.168.1.223
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255
Gateway 192.168.1.1
Dns-nameservers 202.99.96.68

5. Compile a simple socket program by referring to the online example

Communication between the server and the client is realized. When the client connects to the server, the server will send a message to the client and display it on the client.

After completing the 5.1 compilation, I simply learned the gcc usage and compiled some minor errors for the server. c and client. c files. Finally, I solved the problem.

5.2 run server. o client. o

./Server. o
./Client. o 127.0.0.1

The server listens normally, but the client fails to connect to the server. I was eager to run the program, so I did not find out the error for most of the day. I found that the socket was not initialized because of the operator priority. This made me very depressed, but I really don't know the priority of the two operators. I must be careful when referring to other people's programs.

6. After the program runs normally, I start to learn how to write makefile. I plan to use the make command to compile my project.

There is a lot of help on the makefile Writing Method online, and the simple makefile writing method will soon be learned.
Makeserver

Server: server. o
Gcc-o server. o
Server. o: server. c
Gcc-c server. c

Clean:
Rm server. o

Use the make clean command to clear files

7. End

I hope my experience will be helpful to everyone.

Author: happystone1984
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.