Java Network Programming

Use of the Internet Access class 1. Overview Computer network: Interconnect computers distributed in different geographic areas with specialized external equipment using communication lines to form a large-scale and powerful network system, so that many computers can easily transfer information to each other and share hardware, softwar ...

Posted by j7n5u on Mon, 04 May 2020 23:00:20 -0700

Web static server

Web static server Programming micro Web static server-1-display fixed page #coding=utf-8 import socket def handle_client(client_socket): "Serving a client" recv_data = client_socket.recv(1024).decode("utf-8") request_header_lines = recv_data.splitlines() for line in request_header_lines: print(line) # Organize corr ...

Posted by magaly on Mon, 04 May 2020 18:50:22 -0700

A thorough explanation of the 1024 limitation of Linux select (is the selection really limited by 1024?No)

Many years ago, I was interviewed. Why does the select call support up to 1024 file descriptors? I didn't answer, I didn't even know what select was doing. Over the years, I interviewed people with this question... At that time, I already had an expected answer in my mind that would satisfy me, and my expectation was probably: Macros in th ...

Posted by mash on Mon, 04 May 2020 05:49:53 -0700

Thinking about two methods of multithreading ticket selling

package com.swift.duoxiancheng; class Ticket extends Thread { Ticket(String name) { super(name); // Constructor: set thread name } public static int ticket = 1000; @Override public void run() { while (true) { synchronized ("lock") { if (ticket > 0) { tic ...

Posted by tnewton on Sun, 03 May 2020 18:55:22 -0700

Simple implementation of Linux multi process CS server

Simple implementation of Linux multi process CS server server side Multi process realizes multi-user connection, i.e. one connection for each user. Here, the server is still used to capitalize the received string and return it to the client. code implementation #include <stdio.h> #include <string.h> #include <netinet/in.h> ...

Posted by allinurl on Sun, 03 May 2020 14:00:54 -0700

Install mysql5.7 through binary source code under Linux (5.7 installation and commands are different from previous versions)

Here I choose the official website to download the source package, compile and install Reference 1: when linux is configured, how do you choose to install it by compilation or by yum Reference 2: mysql installation under linux 1, Preparation: Download address on Mysql official website 2, Pit summary: 2.1 about i ...

Posted by Brendan Nolan on Sun, 03 May 2020 07:56:02 -0700

Java network programming - AIO programming

1, Introduction In AIO programming, the concept of asynchronous channel is introduced on the basis of NIO, and the realization of asynchronous file and asynchronous socket channel is provided, so as to realize asynchronous non blocking in the true sense. NIO is only non blocking rather than asynchronous. AIO does not need to poll the registere ...

Posted by trial_end_error on Sat, 02 May 2020 08:54:33 -0700

Using upnp to configure router port mapping under ubuntu

Using the command line tool MiniUPnP client Installation method: Download the source code here and compile it as follows: make sudo checkinstall This way, you can uninstall it later. usage method: Usage : upnpc [options] -a ip port external_port protocol [duration] Add port redirection upnpc [ ...

Posted by phpeanuts on Thu, 30 Apr 2020 19:39:27 -0700

Binary installation of mysql installation

Download the tar of mysql binary installation file, and place the GZ package in / usr/local / Run script file #!/bin/bash function Cuser { groupadd -g 27 -o -r mysql useradd -M -N -g mysql -o -r -d /usr/local/mysql/data -s /bin/false -c "MySQL Server" -u 27 mysql } function file-tar { cd /usr/local/ ...

Posted by Jay87 on Wed, 29 Apr 2020 08:59:44 -0700

Source code series -- OkHttp

OkHttp official website address: https://square.github.io/okhttp/ We talked about get request earlier. Let's take a look at post request package okhttp3.guide; import java.io.IOException; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; public class PostEx ...

Posted by md7dani on Tue, 28 Apr 2020 20:00:40 -0700