AndroidTV端:酒店扫码认证投屏DLNA

被老板叼了几次了,最近实在忍不了,准备离职;

但是担心离职后长时间没有办法找到工作

就想贡献一套平时琢磨出来的程序,请各位有能力的话带我熬过这凛冽的寒冬。

目前写出来的,有三个端:安卓TV端,安卓手机端,Windows-Qt端

这篇是TV端的部分代码,当然要理解一下,我并不能粘贴出完整的代码,请见谅;

想要获取完整源码可以直接私信我,万分感激

那下面就开始粘贴部分源码:

1.SSDP的发送

DLNA是通过监听网络当中的广播进行解析的,也就是在循环发送几个消息

这些消息,有的是关于设备信息的,有些是关于控制命令的,总之得根据自己的来

public String toString(int i) {//都是些固定格式,NT和USN是两辆相关StringBuilder content = new StringBuilder();content.append("NOTIFY * HTTP/1.1").append("\r\n");content.append("SERVER: Linux/3.14.29 UPnP/1.0 Cling/2.0").append("\r\n");content.append("CACHE-CONTROL: max-age=1800").append("\r\n");//指定通知消息存活时间,如果超过此时间间隔,控制点可以认为设备不存在content.append("LOCATION: "+_LOCATION).append("\r\n");//乐播投屏加了下面三行,加了就搜索不到了
//        content.append("OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01; ds=0").append("\r\n");
//        content.append("01-NLS: 0dcebdf8-1dd2-11b2-8b72-f07170d94291").append("\r\n");
//        content.append("X-User-Agent: redsonic").append("\r\n");content.append("NTS: ssdp:alive").append("\r\n");if(i==0){content.append("NT: upnp:rootdevice").append("\r\n");content.append("USN: uuid:"+ MainActivity._UUID+"::upnp:rootdevice").append("\r\n");}else if(i==1){content.append("NT: uuid:"+MainActivity._UUID).append("\r\n");content.append("USN: uuid:"+MainActivity._UUID).append("\r\n");} else if(i==2){content.append("NT: urn:schemas-upnp-org:device:MediaRenderer:1").append("\r\n");content.append("USN: uuid:"+MainActivity._UUID+"::urn:schemas-upnp-org:device:MediaRenderer:1").append("\r\n");}else if(i==3){content.append("NT: urn:schemas-upnp-org:service:RenderingControl:1").append("\r\n");content.append("USN: uuid:"+MainActivity._UUID+"::urn:schemas-upnp-org:service:RenderingControl:1").append("\r\n");}else if(i==4){content.append("NT: urn:schemas-upnp-org:service:ConnectionManager:1").append("\r\n");content.append("USN: uuid:"+MainActivity._UUID+"::urn:schemas-upnp-org:service:ConnectionManager:1").append("\r\n");}else if(i==5){content.append("NT: urn:schemas-upnp-org:service:AVTransport:1").append("\r\n");content.append("USN: uuid:"+MainActivity._UUID+"::urn:schemas-upnp-org:service:AVTransport:1").append("\r\n");}content.append("HOST: 239.255.255.250:1900").append("\r\n");content.append("\r\n");//Log.e("SSDPSendMsg",MainActivity._UUID+"\r\n\r\n");return content.toString();//https://blog.csdn.net/thebestleo/article/details/50800781}

安卓端,发送成功后,其实并不能在各大平台的设备上正常显示

这时候就需要在安卓端搭建一个web服务,web服务里面指向一个描述的xml,有关这个投屏设备的一些可以使用的信息,比如酒店某个“房间号”,“品牌+房间号”都可以动态设置,比如我就设置的MyDLNA

2.搭建一个web服务

//noinspection GradleDependency
api 'org.eclipse.jetty:jetty-server:8.1.21.v20160908'
//noinspection GradleDependency
api 'org.eclipse.jetty:jetty-servlet:8.1.21.v20160908'
//noinspection GradleDependency
api 'org.eclipse.jetty:jetty-client:8.1.21.v20160908'
api 'org.nanohttpd:nanohttpd:2.3.1'

我这边就不粘贴很多

粘贴一下认证部分的内容,认证说起来也简单,就是电视端给一个链接让手机端可以访问,电视端把这个链接转换成二维码;

手机要先连接和电视机端同样的网络下面,手机扫码后直接就请求电视机了

扫码后请求电视机会拿到请求的头部,也就请求来的手机ip地址,把这个ip缓存一下,做一下判断,只给这个手机ip发送广播,这样就可以实现扫码后单一的投屏,就不会在同一个酒店下面显示所有房间的电视机了

public class ControlHandler extends org.eclipse.jetty.server.handler.DefaultHandler {private Activity myactivity;private String PlayerURL = "";private String DesiredVolume = "";private String PlayTarget = "";private String PlayState = "NO_MEDIA_PRESENT";private String PlayerURLTemp = "xxx";public ControlHandler(Activity activity) {super();this.myactivity = activity;}@Overridepublic void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {if (response.isCommitted() || baseRequest.isHandled()) {return;}Log.e("RequestShare", request.getRequestURI());//认证过就返回if (request.getRequestURI().contains("/certification")) {Constants.IPDEVICE = request.getRemoteAddr();Log.e("RequestShare", "正在认证设备");baseRequest.setHandled(true);ServletMsg.certificationMsg(response);}//这个是读取认证的设备的(可以使得投屏设备具有唯一性)if (request.getRequestURI().contains("/upnp/dev/" + MainActivity._UUID + "/desc")) {//验证可以通过对比IP实现指定设备投屏if (Constants.ALLDEVICES) {Log.e("RequestShare", "所有设备都可以投屏");baseRequest.setHandled(true);ServletMsg.defaultMsg(response);} else {if (request.getRemoteAddr().contains(Constants.IPDEVICE)) {//验证可以通过对比IP实现指定设备投屏Log.e("RequestShare", "指定:" + request.getRemoteAddr() + "设备符合投屏条件");baseRequest.setHandled(true);response.addHeader("Content-type: ", "text/xml");response.addHeader("SERVER: ", "Linux/3.14.29 UPnP/1.0 Cling/2.0");response.addHeader("Cache-control: ", "max-age=1800");
//                    response.addHeader("X-User-Agent: ","redsonic");ServletMsg.defaultMsg(response);}}}//请求分析if (Constants.ALLDEVICES) {getHeader(request, baseRequest, response); //头部执行播放暂停之类的简单操作getBody(request, baseRequest, response);//这个主要是主要处理有携带参数的数据,response还是加了一下,避免以后自己做控制端//爱奇艺和腾讯会请求里面链接,单纯回复可能不管用,加的一项ServletRequest(request, baseRequest, response);} else {if (request.getRemoteAddr().contains(Constants.IPDEVICE)) {//验证可以通过对比IP实现指定设备投屏Log.e("RequestShare1", request.getRemoteAddr());//IP地址Log.e("RequestShare2", request.getRequestURI());//请求的路径getHeader(request, baseRequest, response); //头部执行播放暂停之类的简单操作getBody(request, baseRequest, response);//这个主要是主要处理有携带参数的数据,response还是加了一下,避免以后自己做控制端//爱奇艺和腾讯会请求里面链接,单纯回复可能不管用,加的一项ServletRequest(request, baseRequest, response);}}}

3.投射视频

讲到投射视频,就很简单了,可以理解为手机向电视机发送了一个请求,只不过这个请求头请求体都需要根据特定格式来

例如:

<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>http://183.131.147.16/upgcxcode/09/78/1255627809/1255627809-1-192.mp4?e=ig8euxZM2rNcNbNBhWdVhwdlhbU1hwdVhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8gNEVE5XREto8z5JZC2X2gkX5L5F1eTX1jkXlsTXHeux_f2o859IMvNC8xNbLEkF6MuwLStj8fqJ0EkX1ftx7Sqr_aio8_&amp;ua=tvproj&amp;uipk=5&amp;nbs=1&amp;deadline=1693797974&amp;gen=playurlv2&amp;os=bcache&amp;oi=3728755326&amp;trid=00002c92df64c42a43fa9d53a3d4ca9263eaT&amp;mid=434537794&amp;upsig=a446d61c8f79924e141b2973d94a0715&amp;uparams=e%2Cua%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid&amp;cdnid=22222&amp;bvc=vod&amp;nettype=0&amp;bw=251536&amp;orderid=0%2C3&amp;buvid=Y947C4998063ABA44C5595C15C70401D62DF&amp;build=70100100&amp;mobi_app=iphone&amp;f=T_0_0&amp;logo=80000000&amp;_nva_ext_=</CurrentURI><CurrentURIMetaData>&lt;DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"&gt;&lt;item id="0" parentID="-1" restricted="1"&gt;&lt;dc:title&gt;我花1万块重庆打车到上海,却被全国网友说成老赖?&lt;/dc:title&gt;&lt;upnp:storageMedium&gt;UNKNOWN&lt;/upnp:storageMedium&gt;&lt;upnp:writeStatus&gt;UNKNOWN&lt;/upnp:writeStatus&gt;&lt;upnp:longDescription&gt;8ZPKtX3aKq2ata7O0mJBw8X-jfpm6X7rvBzgi6zEJLdfXlUYjO_zomV6xIkLrNS8Y97j6EBY4i-BmrgA2WWIqDn9Gd6p83nZCVDTdbhDOos4x_QGAByL3FXnYPdYvFYaHluTvVQ5MKCckyKCQIKKxdYatoPoEqsgeVHUPN4WtaAChNi5UaHQfwtwRNaZO_SSa9jnMEYFDhN4kpzC4A0TmmqKUbUQvdIR9fh7acHLpKz3Rt7XmnEu-o9jfV7km3nwBpPT8il6Ycxp5Gw0k-kEa192ccOzzA0V11Bg7EntZzm7aJKn2QVwqg5t8hFPxpdS32W6yzM1W-7usjfm2SOESC4guqmfBlaOxdVL8hnG3mdl_BGU3kmcVhKz8u0u79UsDTWEElD1088XFetEb--WevzgLqcQF53VlmwPzCF1hoIXID5L4UaTmLu6cSzi3dKW&lt;/upnp:longDescription&gt;&lt;res protocolInfo="http-get:*:video/mp4:DLNA.ORG_PN=MPEG4_P2_SP_AAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"&gt;http://183.131.147.16/upgcxcode/09/78/1255627809/1255627809-1-192.mp4?e=ig8euxZM2rNcNbNBhWdVhwdlhbU1hwdVhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8gNEVE5XREto8z5JZC2X2gkX5L5F1eTX1jkXlsTXHeux_f2o859IMvNC8xNbLEkF6MuwLStj8fqJ0EkX1ftx7Sqr_aio8_&amp;amp;ua=tvproj&amp;amp;uipk=5&amp;amp;nbs=1&amp;amp;deadline=1693797974&amp;amp;gen=playurlv2&amp;amp;os=bcache&amp;amp;oi=3728755326&amp;amp;trid=00002c92df64c42a43fa9d53a3d4ca9263eaT&amp;amp;mid=434537794&amp;amp;upsig=a446d61c8f79924e141b2973d94a0715&amp;amp;uparams=e%2Cua%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid&amp;amp;cdnid=22222&amp;amp;bvc=vod&amp;amp;nettype=0&amp;amp;bw=251536&amp;amp;orderid=0%2C3&amp;amp;buvid=Y947C4998063ABA44C5595C15C70401D62DF&amp;amp;build=70100100&amp;amp;mobi_app=iphone&amp;amp;f=T_0_0&amp;amp;logo=80000000&amp;amp;_nva_ext_=&lt;/res&gt;&lt;upnp:class&gt;object.item.videoItem&lt;/upnp:class&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>

 这就是发过来的视频连接,适当解析后就可以正常播放了

4.监听播放与控制进度

手机端会不断给电视端发送实时数据,比如音量啊,进度啊,这些;手机监听到系统音量后,会给DLNA也发一条关于音量的数据,电视机拿到就处理一下即可

大部分视频厂家都是可以正常上报,优酷和芒果倒是加了些机制,需要电视机端给设备发消息,说我已经开始播放了,然后优酷才会继续播,不然播了两秒,优酷没有收到电视机的消息,会立刻把链接关掉云云..

 //获取body信息private void getBody(HttpServletRequest request, Request baseRequest, HttpServletResponse response) throws IOException {Log.e("getBody", "------getBody分割线start------");BufferedReader br = request.getReader();String str, wholeStr = "";while ((str = br.readLine()) != null) {wholeStr += str;}Log.e("getBody", wholeStr);//拿到播放的链接if (wholeStr.contains("u:SetAVTransportURI")) {Log.e("55m5m53", wholeStr);String temp = wholeStr.substring(0, wholeStr.indexOf("</CurrentURI>"));PlayerURL = temp.substring(temp.indexOf("<CurrentURI>")).replace("<CurrentURI>", "").replace("&amp;", "&").replace("&quot;", "\"").replace("&lt;", "<").replace("&gt;", "<").replace("&nbsp;", " ").replace("&apos;", "'");Log.e("55m5m54", PlayerURL);PlayState = "PLAYING";//Response响应一下baseRequest.setHandled(true);ServletMsg.SetAVTransportURIResponseMsg(response);//发送并打开页面给播放器
//            Intent intent = new Intent(myactivity, PlayerActivity.class);
//            intent.putExtra("PlayerURL", PlayerURL);
//            myactivity.startActivity(intent);//芒果TV一次性发了5个
//            if (!PlayerURL.equals(PlayerURLTemp)) {
//                PlayerURLTemp = PlayerURL;countDownTimer.start();
//                intent.putExtra("PlayerURL", PlayerURL);
//                myactivity.startActivity(intent);
//            }} else if (wholeStr.contains("u:SetVolume")) {//摘取出要我设置的音量String Volume = wholeStr.substring(0, wholeStr.indexOf("</DesiredVolume>"));DesiredVolume = Volume.substring(Volume.indexOf("<DesiredVolume>")).replace("<DesiredVolume>", "");Log.e("SetVolume", DesiredVolume);//Response响应一下baseRequest.setHandled(true);ServletMsg.SetVolumeResponseMsg(response);//到这边的意思就是和播放器说要控制一下设备的音频SendBroadcast("Volume#" + DesiredVolume);} else if (wholeStr.contains("u:Seek")) {//摘取出要我设置的进度String Target = wholeStr.substring(0, wholeStr.indexOf("</Target>"));PlayTarget = Target.substring(Target.indexOf("<Target>")).replace("<Target>", "");Log.e("PlayTarget", PlayTarget);SendBroadcast("Seek#" + PlayTarget);//告诉播放器,我要设置进度了} else if (wholeStr.contains("u:GetTransportInfo")) {//告诉控制端,我还活着Log.e("u:GetTransportInfo", "电视系统的State:" + PlayState);baseRequest.setHandled(true);ServletMsg.GetTransportInfoMsg(response, PlayState, "OK");} else if (wholeStr.contains("u:GetVolume")) {//腾讯bilibili会要求获取一下音量,就给呗//bilibili给了后,会一直索要~好奇怪Log.e("u:GetVolume", "电视系统的Volume:" + PlayerActivity.playerData.get_volume());baseRequest.setHandled(true);ServletMsg.GetVolumeMsg(response, PlayerActivity.playerData.get_volume());} else if (wholeStr.contains("u:GetPositionInfo")) {//告诉控制端我当前的播放状态GetPositionInfo(response, baseRequest);} else if (wholeStr.contains("u:GetMediaInfo")) {//爱奇艺单独列了这个~,尝试发了,但没反应,找了几个数据,应该是正确的Log.e("getBody", "我拿到GetMediaInfo了");GetMediaInfo(response, baseRequest);} else if (wholeStr.contains("u:Stop")) {//有些东西需要响应的,就响应一下Log.e("getBody", "我拿到Stop了");baseRequest.setHandled(true);ServletMsg.StopResponseMsg(response);}Log.e("getBody", "------getBody分割线end------");}private CountDownTimer countDownTimer = new CountDownTimer(1000, 1000) {@Overridepublic void onTick(long millisUntilFinished) {}@Overridepublic void onFinish() {//PlayerURLTemp="Fowlet";if(isTopActivity(Constants.PLAYACTIVITY)){SendBroadcast("State#Stop");}Intent intent = new Intent(myactivity, PlayerActivity.class);//Intent intent = new Intent(myactivity, Player2Activity.class);intent.putExtra("PlayerURL", PlayerURL);myactivity.startActivity(intent);}};//获取的头部信息private void getHeader(HttpServletRequest request, Request baseRequest, HttpServletResponse response) {Log.e("getHeader", "------getHeader分割线start------");Enumeration<String> em = request.getHeaderNames();while (em.hasMoreElements()) {String name = (String) em.nextElement();String value = request.getHeader(name);//System.out.println(name + "=" + value);Log.e("getHeader", name + "=" + value);if (name.equals("SOAPAction") | name.equals("SOAPACTION")) {String[] split = value.split("#");String result = split[1];//获取头部的一些快捷操作,如果说有一些要参数要回调的话,还是要走bodyString Transport = result.substring(0, result.indexOf("\""));Log.e("yongge", Transport);if (Transport.equals("Play")) {//播放PlayState = "PLAYING";Log.e("Header__", "我拿到Play了:" + PlayState);//开始播放了就让播放器开始收集信息//SendBroadcast("GetInfo#"+Transport);//暂停播放也会用的到SendBroadcast("State#" + Transport);} else if (Transport.equals("Stop")) {//停止PlayState = "STOPPED";Log.e("Header", "我拿到Stop了:" + PlayState);SendBroadcast("State#" + Transport);} else if (Transport.equals("Pause")) {//暂停PlayState = "PAUSED_PLAYBACK";Log.e("Header__", "我拿到Pause了:" + PlayState);SendBroadcast("State#" + Transport);} else if (Transport.equals("SetVolume")) {//设置音量Log.e("Header", "我拿到SetVolume了" + DesiredVolume);} else if (Transport.equals("GetPositionInfo")) {SendBroadcast("GetInfo#" + Transport);//告诉播放器,你要开始收集播放器信息了//获取进度Log.e("Header", "我拿到GetPositionInfo了");} else if (Transport.equals("GetTransportInfo")) {//获取传输状态//安卓端的腾讯是拿的GetTransportInfoLog.e("Header", "我拿到GetTransportInfo了");} else if (Transport.equals("SetMute")) {//静音/取消Log.e("Header", "我拿到SetMute了");} else if (Transport.equals("Seek")) {//设置进度Log.e("Header", "我拿到Seek了" + PlayerActivity.playerData.get_seek());} else if (Transport.equals("GetMediaInfo")) {//爱奇艺单独列了这个~Log.e("Header", "我拿到GetMediaInfo了");} else if (Transport.equals("GetVolume")) {Log.e("Header", "我拿到GetVolume了");}}//优酷是要走订阅if (name.equals("CALLBACK")) {String callbackUrl = value.replace("<", "").replace(">", "");Log.e("callbackUrl", callbackUrl);String str[] = callbackUrl.replace("/","").split(":");try {Socket socket = new Socket(str[1], Integer.parseInt(str[2]));Log.e("callbackUrl2", str[1]+"---"+str[2]);BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));bw.write("HTTP/1.1 200 OK\r\n");bw.write("Server: Linux/3.14.29 UPnP/1.0 Cling/2.0\r\n");bw.write("SID: uuid:"+MainActivity._UUID+"\r\n");bw.write("Content-Type: text/html; charset=\"utf-8\""+"\r\n");bw.write("TIMEOUT: Second-3600"+"\r\n\r\n");bw.flush();BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));while(true) {String readLine = null;if ((readLine = br.readLine()) != null) {Log.e("socket", readLine);} else {break;}}} catch (IOException e) {e.printStackTrace();}
//                YoukuMsg youkuMsg = new YoukuMsg();
//                //要返回一下订阅成功
//                baseRequest.setHandled(true);
//                ServletMsg.VendorMsg(response, youkuMsg.toString());//                SubResponse subRespons = new SubResponse();
//                subRespons.getTest(callbackUrl,MainActivity._UUID);//                onUnicastSend("172.16.0.121", 49152);//源IP和源端口
//
//                response.setStatus(SC_OK);
//                response.addHeader("Server: ","Linux/3.14.29 UPnP/1.0 Cling/2.0");
//                response.addHeader("SID: ","uuid:"+MainActivity._UUID);
//                //response.addHeader("Content-Type: ","text/html; charset=\"utf-8\"");
//                response.addHeader("TIMEOUT: ","Second-3600");
//                response.setContentType("text/html; charset=\"utf-8\"");
//
//                baseRequest.setHandled(true);
//                ServletMsg.VendorMsg(response, TencentMsg.RenderingControl_desc);
//                baseRequest.setHandled(true);
//                ServletMsg.VendorMsg(response, "");//                response.setHeader();}}Log.e("getHeader", "------getHeader分割线end:" + PlayState + "------");}

处理返回的进度

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/99349.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Windows 常用工具系列 11 -- 笔记本F5亮度调节关闭】

文章目录 笔记本 F 按键功能恢复 笔记本 F 按键功能恢复 使用笔记本在进行网页浏览时&#xff0c;本想使用F5刷新下网页&#xff0c;结果出现了亮度调节&#xff0c;如下图所示&#xff1a; 所以就在网上查询是否有解决这个问题的帖子&#xff0c;结果还真找到了&#xff1a;…

java IO流(三) 转换流 打印流

转换流 前面我们学习过FileReader读取文件中的字符&#xff0c;但是FileReader默认只能读取UTF-8编码格式的文件。如果使用FileReader读取GBK格式的文件&#xff0c;可能存在乱码&#xff0c;因为FileReader遇到汉字默认是按照3个字节来读取的&#xff0c;而GBK格式的文件一个…

【微服务部署】三、Jenkins+Maven插件Jib一键打包部署SpringBoot应用Docker镜像步骤详解

前面我们介绍了K8SDockerMaven插件打包部署SpringCloud微服务项目&#xff0c;在实际应用过程中&#xff0c;很多项目没有用到K8S和微服务&#xff0c;但是用到了Docker和SpringBoot&#xff0c;所以&#xff0c;我们这边介绍&#xff0c;如果使用Jenkinsjib-maven-plugin插件打…

数据结构day7栈-顺序栈的实现

用指针比用数组好&#xff0c;这样用户可以自己指定空间的大小&#xff0c;有参与感。 全部代码: main.c #include <stdio.h> #include <string.h> #include "sqstack.h"int main(int argc, char *argv[]) {sqstack *s;int i;s stack_create(100);if(…

Python continue 语句

Python continue 语句跳出本次循环&#xff0c;而break跳出整个循环。 continue 语句用来告诉Python跳过当前循环的剩余语句&#xff0c;然后继续进行下一轮循环。 continue语句用在while和for循环中。 Python 语言 continue 语句语法格式如下&#xff1a; continue 流程图…

go语言 go mod生成

1. go hello world 创建文件夹gotest&#xff0c;在其中创建test1.go文件&#xff0c;并写入 package mainimport ("fmt" )func main() {fmt.Println("hello world") } 运行命令 go run test1.go 可以看到输出hello world 2. cli 命令行的使用 代码如下…

口才训练方法和技巧有哪些?

口才是一种重要的沟通技能&#xff0c;可以帮助人们更好地表达自己&#xff0c;影响他人&#xff0c;并建立更强的人际关系。在这篇文章中&#xff0c;我们将探讨一些口才训练的方法和技巧&#xff0c;帮助你提高口才水平。 1. 提前准备&#xff1a;在进行任何演讲或公开演讲之…

【Linux网络编程】环境配置篇

由于博主本学期所使用的Linux系统为Ubuntu&#xff0c;所以这篇博客会先以安装虚拟机和Ubuntu开始。 虚拟机的话&#xff0c;可以选择VMware&#xff0c;也可以选择VirtualBox。直接选择安装就行&#xff0c;这个应该是没有什么问题的。但是&#xff0c;如果之前电脑安装过Vmwa…

go Session的实现(一)

〇、前言 众所周知&#xff0c;http协议是无状态的&#xff0c;这对于服务器确认是哪一个客户端在发请求是不可能的&#xff0c;因此为了能确认到&#xff0c;通常方法是让客户端发送请求时带上身份信息。容易想到的方法就是客户端在提交信息时&#xff0c;带上自己的账户和密…

分布式环境集成JWT(Java Web Token)

目录 一&#xff0c;说明&#xff1a;二&#xff0c;Token、Session和Cookie比较三&#xff0c;Spring Boot项目集成JWT1&#xff0c;引入依赖2&#xff0c;Token工具类3&#xff0c;定义拦截器4&#xff0c;注册拦截器5&#xff0c;编写登录代码6&#xff0c;测试 四&#xff…

#include <graphics.h> #include <conio.h> #include<stdlib.h>无法打开源文件解决方案

一、问题描述 学习数据结构链表的过程中&#xff0c;在编写漫天星星闪烁的代码时&#xff0c;遇到了如下图所示的报错&#xff0c;#include <graphics.h> 、 #include <conio.h> 等无法打开源文件。 并且主程序中initgraph(初始化画布)、setfillcolor&#xff08;…

【权限提升-Windows提权】-UAC提权之MSF模块和UACME项目-DLL劫持-不带引号服务路径-不安全的服务权限

权限提升基础信息 1、具体有哪些权限需要我们了解掌握的&#xff1f; 后台权限&#xff0c;网站权限&#xff0c;数据库权限&#xff0c;接口权限&#xff0c;系统权限&#xff0c;域控权限等 2、以上常见权限获取方法简要归类说明&#xff1f; 后台权限&#xff1a;SQL注入,数…