- 博客(8)
- 收藏
- 关注
原创 第二章 套接字类型与协议设置
套接字类型与协议设置套接字协议及其数据传输特性关于协议计算机间对话必备通信规则一、 创建套接字#include <sys/socket.h>int socket(int domain, int type, int protocol);成功返回文件描述符,失败返回-1domain:套接字中使用的协议族(Protocol Family)信息type:套接字数据传输类型信息protocol:计算机通信中使用的协议信息协议族套接字实际使用协议信息通过socket第三个参
2021-09-13 23:03:39
145
原创 第一章 网络编程和套接字
HelloWord!接受连接请求的套接字创建过程调用socket函数创建套接字调用bind函数分配IP地址和端口号调用listen函数转为可接收请求状态调用accept函数受理连接请求hello_server.c#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <arpa/inet.h>#include
2021-09-13 22:10:28
203
原创 python流程控制
if>>> x = int(input("Please enter an integer:"))Please enter an integer:42>>> if x < 0:... x = 0... print("Negative changed to zero")... elif x == 0:... print('Zero')... elif x == 1:... print('Single')... else
2021-03-23 23:32:50
249
原创 AppBarLayout嵌套CollapsingToolbarLayout实现折叠屏去除阴影
效果图:代码:<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.a
2021-01-22 17:35:54
1303
原创 AndroidStudio 4.1.2禁用Androidx
修改gradle.propertiesandroid.useAndroidX=false# Automatically convert third-party libraries to use AndroidXandroid.enableJetifier=false降低AndroidStudio gradle插件版本dependencies { classpath "com.android.tools.build:gradle:3.1.4" // NOT.
2021-01-22 16:49:22
1415
原创 double check单例和静态内部类单例
双检查,单例使用volatile修饰遵循 JSR133 规范的 Java 中public class Singleton { private volatile Singleton instance = null; public Singleton getInstance() { if (instance == null) { synchronized(this) { if (instance ==
2020-12-24 10:44:58
220
原创 Android 获取MimeType
public static String getMimeType(Context context, Uri uri, String filePath){ String mediaType = null; try{ MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(filePath); mediaType = mmr.extractMetadata(MediaMetadataR
2020-12-16 14:32:59
530
原创 Python简单介绍
数字除法运算 (/) 返回float类型>>> 8 / 5 1.6>>> 8 // 51>>> 7 / 51.4>>> 7 // 51>>> 8 % 53** 运算符计算乘方>>> 5 ** 225>>> 2 ** 7128=赋值>>> width = 20>>> height = 5 *
2020-12-15 21:10:36
151
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人