For more information about socket programming, see Linux general technology-Linux programming and kernel. [I = s] This post was last edited by onepiece
Hello everyone, I am a newbie. I have just recently learned linux programming. I want to ask you a question. I want to write a socket program in C language in linux, on the Internet, I found a simple socket example (a helloworld program). how can I run it?
PS: I wrote it using emacs. it uses the gcc compiler and the entire system runs in a virtual machine environment. I want to know the specific operations, from compiling to running the display results. Can anyone help me .......
I wanted to post the code, but it was a bit too much, so I was afraid that everyone would be upset .. Let me briefly describe it. a Linux Socket programming instance (a Hello World program) writes a small socket program in Linux, which can be divided into a client and a server, the server opens a port (2000) as a daemon, waiting for the customer's connection request. once a client is connected, the server prints the IP address and port of the client and sends the welcome message and time to the server. only single-thread implementation is used.
There are two sections of code, namely the server-side code and the client-side code. do you want to write the two sections of code in two files separately and then compile and run the code? How does it work? can you tell me in detail? currently, I only use GCC to compile and run the C language "helloworld", and I don't know much about it. I hope you will pay attention to it, I am very grateful ..
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