下面的python代码用于监控本机的8080端口,当用于通过http请求,服务器返回固定的html代码 import SocketServer class MyRequestHandler(SocketServer
基于CXF的WebService服务端代码 ESBServiceSoap.java package com.esb.services.commservices; import javax.jws.WebMethod;
package main import ( "fmt" "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("./"))) e := http.ListenAndServe(":8080", nil) fmt.Println(e) }
private Boolean isServiceRunning(String serviceName) { ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo runningServiceInfo : activityMana
import java.net.*; import java.nio.ByteBuffer; import java.nio.channels.*; import java.nio.charset.*; import java.util.concurrent.*; import java.io.*; public class SimpleHttpServer { private int port
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; i
import ftplib ftp = ftblib.FTP("ftp.yourServer.com") ftp.login("username", "password") filename = "index.html" ftp.storlines("STOR " + filename, open(filename)) filename="app.exe" ftp.storbinary("STOR
判断当前网络是否是3G网络 public static boolean is3G(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeN
当然如果你的项目大的话最好使用开源的网络库ASI或者AFNetWork,库里面都有现有的方法, 如果你觉得就是想自己写一个,看这里 - (NSMutableURLRequest *)PostImageRequest:(NSString *)URLString UIImage:(UIImage*)image
#!/usr/bin/python #-*- coding:utf-8 -*- import sys, time, os try: import pexpect except ImportError: print """ You must install pexpect module """ sys.exit(1) addr_map = { 'v3' :('root@192.168.1.162',
import threading import SocketServer import json import time class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): def handle(self): start_time=time.time() print start_time data = self.req
private void downFile(HttpServletResponse response, HttpServletRequest request, String location){ BufferedInputStream bis = null; try { File file = new File(location); if (file.exists()) { long p = 0L
/* * Sample showing how to do SSH2 connect. * * The sample code has default values for host name, user name, password * and path to copy, but you can specify them on the command line like: * * "ssh2 h
import java.io.IOException; import java.nio.file.*; public class DirectoryWatcher { public static void main(String[] args) throws IOException, InterruptedException { WatchService watchService = FileSy
这个方法可以把通过mysqldump 把本地数据库备份到远端主机, 中间数据的传输通过 ssh 加密。 远端主机上通过cat 读取标准输入然后把mysqldump 的重定向到文件中。 mysqldump <DATABASE_NAME> [mysqldump options] | gzip -c | ssh user@remotehost "cat > /path/to/some-file.sql.
import org.apache.commons.net.ftp.FTPClient; import java.io.FileInputStream; import java.io.IOException; public class FtpFileUpload { public static void main(String[] args) { FTPClient client = new FT
本代码演示了python的urllib2模块如何使用代理,以及需要登录验证的proxy # The proxy address and port: proxy_info = { 'host' : 'proxy.myisp.com', 'port' : 3128 } # We create a handler for the proxy proxy_support = urllib2.ProxyHa
习同步方式是很有必要的,异步是从同步过渡过去的。首先你需要 创建两个控制台项目 一个为Server / 服务器 另一个为Client / 客户端 服务器: namespace Server { using System; using
C# socket 服务端与客户端通信演示代码 主要实现服务端与客户端消息和文件的相互发送,服务端可以控制客户端:重启、关机、注销,截屏(截客户端的屏)。服务端也可向客户端发送闪屏。 using System;
e.printStackTrace(); } return null; } /** * 创建非阻塞服务器绑定5555端口 */ public Server() { try { ss = ServerSocketChannel