select monitors on stdout and sockets

The content of selectServerInTCPIPbook.c is as follows: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/time.h> #include <sys/select.h> #defineBUF_SIZE 100 void error_handling(char *buf); int main(int argc, char *argv[]) {<!– –> int serv_sock, clnt_sock; struct sockaddr_in serv_adr, clnt_adr; struct timeval timeout; fd_set reads, cpy_reads; socklen_t adr_sz; int fd_max, str_len, fd_num, i; […]

Linux redirection – stdin, stdout – terminal type

Standard input (standard input) 0 defaults to accept input from the keyboard Standard output (standard output) 1 default output to the terminal window (screen) Standard error output (standard error output) 2 default output to the terminal window (screen) # View the process number of the current terminal [root@sc ~]# echo $$ 13082 cd /etc/proc/12082/fd [root@sc […]

Standard IO_open and close files_fopen, fdopen, freopen, stdin, stdout, stderr

Directory 1. Open the file 1.1 fopen function prototype 1.1.1 fopen function 1.1.2 Principle of fopen function 1.1.3 What is the difference between text files and binary files? 1.1.4 What is the difference between “r” mode and “rb” mode? 1.1.5 Example of using fopen function 1.2 fdopen function prototype 1.2.1 fdopen function 1.2.2 Principle of […]

shell command ping & pstree & id & chmod & chown & “> and &>” & format time & –stdin –stdout

ping & amp; pstree & amp; id & amp; chmod & amp; chown & amp; “> and & amp;>” & amp; format time ping concept Common parameters Check if the target host is connected pstree id chmod chown > and &> format time –stdin –stdout ping Concept Ping is often used to test the connectivity […]

Python stdout redirection

Table of contents Python stdout redirection statement 1. Background knowledge 2. Redirect method 2.1 Console Redirection >Redirect”>2.2 print >>Redirect 2.3 sys.stdout redirection 2.4 Context Manager (Context Manager) 2.5 logging module redirection 3. References Statement Based on the Python 2.7 version, this article introduces several common standard output (stdout) redirection methods. Obviously, these methods also apply […]

python@call system command line @os.system@subprocess@standard input and output @[email protected]@input@print

Article directory python@call system command line @os.system@standard input and output @[email protected]@input@print summary os.system demos windows command interpreter @ComSpec subprocess@recommended basic usage demos standard input and output sys.stdin input() sys.stdin.input@input() interactive mode summary sys.stdout sys.stdout.wirte()@print() read from a file @fileinput fileinput.input()@ input content from the file The command line argument provides the filename summary python@call system […]

[Solved] pyspark error – No port number in pyspark.daemon’s stdout

Error content: org.apache.spark.SparkException: No port number in pyspark.daemon’s stdout Using Anaconda for pyspark development, the above error occurred in pycharm. I found a guess from the Internet that the python version in the base environment was inconsistent or incompatible. Later, after replacing the lower version of Anaconda, I used the created environment again and it […]

[Solved] KEIL does not use microlib to report an error __stdin __stdout duplicate definition

Keil does not use microlib, add the following function to the file to redirect printf void _sys_exit(int x) {<!– –> x = x; } FILE __stdout; FILE __stdin; int fputc(int ch, FILE *f) {<!– –> HAL_UART_Transmit( & amp;s_uart1Handle, (uint8_t *) & amp;ch, 1, 0xFFFF); return ch; } If the compilation error __stdin __stdout duplicate definition, […]

[Solved] azkaban startup error 2022/06/20 21:39:27.726 +0800 ERROR [StdOutErrRedirect] [Azkaban] Exception in thread “m

Start the azkaban service, check it with jps after startup, and find that there is no process. I’m a little confused, obviously it can start normally before. After looking at the log file of azkaban, I found that the error was reported: 2022/06/20 21:39:27.726 + 0800 ERROR [StdOutErrRedirect] [Azkaban] Exception in thread “main” 2022/06/20 21:39:27.737 […]