xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 100KB
    文件類(lèi)型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-16
  • 語(yǔ)言: Java
  • 標(biāo)簽:

資源簡(jiǎn)介

一個(gè)還好的Android手機(jī)無(wú)線(WIFI)連接無(wú)線路由實(shí)現(xiàn)局域網(wǎng) 連接電腦后,進(jìn)行文件傳送的Socket/TCP實(shí)例。 需要手機(jī)WIFI連接局域網(wǎng),并設(shè)定IP地址,地址可在程序文件找到,或者自行對(duì)應(yīng)修改,需要統(tǒng)一。

資源截圖

代碼片段和文件信息

package?com.wal.tcpclient;

import?java.io.DataOutputStream;
import?java.io.File;
import?java.io.FileInputStream;
import?java.io.InputStream;
import?java.io.OutputStream;
import?java.net.Socket;
import?java.util.Calendar;
import?java.util.Scanner;

/**
?*?@author?jace
?*?
?*?Functions:
?*? 1.TCPClient,運(yùn)行與Java上的帶主函數(shù)的程序客戶端
?*?
?*? 2.實(shí)現(xiàn)從電腦硬盤(pán)上傳送文件到局域網(wǎng)內(nèi)的WIFI連接的Android客戶端機(jī)器
?*?
?*? 3.該程序?qū)崿F(xiàn)的為L(zhǎng)inux下的文件讀取,Windows用戶需要自行修改幾句代碼,便可簡(jiǎn)單實(shí)現(xiàn)(代碼已經(jīng)注釋?zhuān)?br/>?*?
?*? 4.自己動(dòng)手豐衣足食
?*
?*/
public?class?TCPClient?{

/**
?*?@param?args
?*/
public?static?void?main(String[]?args)?{
try?{
//創(chuàng)建TCP客戶端的Socket
Socket?mTCPSocket?=?new?Socket(“172.16.167.82“?8888);

System.out.println(“-----------------請(qǐng)輸入需傳送的文件路徑-----------------“);

System.out.println(“---------------格式例如:/home/jace/mm.jpg---------------“);

Scanner?sc?=?new?Scanner(System.in);

String?strPath?=?sc.next().toString();

System.out.println(“文件路徑為:strPath?=?“?+?strPath?+?“???strPath的長(zhǎng)度?=?“?+?strPath.length());

//創(chuàng)建輸入流,并設(shè)置輸入流傳遞的文件
InputStream?mInputStream?=?new?FileInputStream(strPath);

//創(chuàng)建輸出流對(duì)象并獲取輸出流
OutputStream?mOutputStream?=?mTCPSocket.getOutputStream();

//創(chuàng)建數(shù)據(jù)輸出流,并將獲得的文件輸出流的數(shù)據(jù)
DataOutputStream?mDataOutputStream?=?new?DataOutputStream(mOutputStream);

//創(chuàng)建字節(jié)數(shù)組
byte[]?buffer?=?new?byte[1024?*?4];

int?temp?=?0;

//Windows系統(tǒng)文件路徑測(cè)試
// String?strWindowsPath?=?“C:\\Program?Files\\Alwil?Software\\Avast4\\ashDisp.exe“;

//字符串(文件路徑)分割,存放于String數(shù)組中
String[]?strDir?=?strPath.split(File.separator);

// String[]?strDir2?=?strWindowsPath.split(“\\\\“);

//打印文件名
System.out.println(“Linux?fileName?=?“?+?strDir[strDir.length?-?1]);

// System.out.println(“Windows?FileName?=?“?+?strDir2[strDir2.length?-?1]);

//將分割出來(lái)的文件名,寫(xiě)入數(shù)據(jù)輸出流中
mDataOutputStream.writeUTF(strDir[strDir.length?-?1]?+?“!“?+?mInputStream.available());

//打印開(kāi)始傳送提示,并顯示當(dāng)前時(shí)間
System.out.println(“-----------------數(shù)據(jù)開(kāi)始傳送-----------------“);
System.out.println(“--現(xiàn)在系統(tǒng)時(shí)間:?“?+?Calendar.getInstance().getTime()?+?“--“);

long?length?=?0;

System.out.println(“l(fā)ength??One------>“?+?mInputStream.available());

//通過(guò)循環(huán)讀取數(shù)據(jù)進(jìn)字節(jié)數(shù)組,并寫(xiě)進(jìn)數(shù)據(jù)輸出流中
while?((temp?=?mInputStream.read(buffer))?!=?-1)?{
// mOutputStream.write(buffer?0?temp);
mDataOutputStream.write(buffer?0?temp);

//疊加讀取緩沖區(qū)的字節(jié)數(shù)大小
length?+=?temp;
}


//打印寫(xiě)入緩沖區(qū)的文件的字節(jié)長(zhǎng)度
System.out.println(“l(fā)ength?Two----->“?+?length);

// mDataOutputStream.writeLong(length);


//刷新并推進(jìn)輸出流
mDataOutputStream.flush();

//打印數(shù)據(jù)傳送完畢提示,并顯示當(dāng)前系統(tǒng)時(shí)間
System.out.println(“----------------------------------------------“);

System.out.println(“-------------------數(shù)據(jù)傳送完畢-----------------“);

System.out.println(“-----完成時(shí)間:?“?+?Calendar.getInstance().getTime()?+?“-----“);

System.out.println(“----------------------------------------------“);

// while?((temp?=?mDataInputStream.read(buffer))?!=?-1)?{
// mDataOutputStre

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????????3214??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\bin\com\wal\tcpclient\TCPClient.class
?????文件????????2391??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\bin\com\wal\udpclient\UDPClient.class
?????文件????????3825??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\src\com\wal\tcpclient\TCPClient.java
?????文件????????1937??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\src\com\wal\udpclient\UDPClient.java
?????文件?????????352??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R$attr.class
?????文件?????????444??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R$drawable.class
?????文件?????????475??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R$id.class
?????文件?????????406??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R$layout.class
?????文件?????????613??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R$string.class
?????文件?????????559??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\R.class
?????文件????????3350??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\SocketDemo01Activity$1.class
?????文件????????2560??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\SocketDemo01Activity$2.class
?????文件????????6397??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\com\wal\socketactivity\SocketDemo01Activity.class
?????文件????????1166??2011-08-29?05:04??SocketDemo\SocketDemo01\gen\com\wal\socketactivity\R.java
?????文件???????13517??2011-08-29?05:04??SocketDemo\SocketDemo01\src\com\wal\socketactivity\SocketDemo01Activity.java
?????文件????????2574??2011-08-29?05:04??SocketDemo\SocketDemo01\res\drawable\icon.png
?????文件????????7599??2011-08-29?05:04??SocketDemo\SocketDemo01\res\drawable\senddata.jpg
?????文件????????4147??2011-08-29?05:04??SocketDemo\SocketDemo01\res\drawable-hdpi\icon.png
?????文件????????1723??2011-08-29?05:04??SocketDemo\SocketDemo01\res\drawable-ldpi\icon.png
?????文件????????2574??2011-08-29?05:04??SocketDemo\SocketDemo01\res\drawable-mdpi\icon.png
?????文件????????1517??2011-08-29?05:04??SocketDemo\SocketDemo01\res\layout\main.xml
?????文件?????????478??2011-08-29?05:04??SocketDemo\SocketDemo01\res\values\strings.xml
?????文件?????????617??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\.settings\org.eclipse.jdt.core.prefs
?????文件???????29245??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\SocketDemo01.apk
?????文件???????10980??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\classes.dex
?????文件???????21772??2011-08-29?05:04??SocketDemo\SocketDemo01\bin\resources.ap_
?????文件?????????295??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\.classpath
?????文件?????????382??2011-08-29?05:03??SocketDemo\Client_For_SocketDemo01\.project
?????文件?????????273??2011-08-29?05:04??SocketDemo\SocketDemo01\.classpath
?????文件?????????815??2011-08-29?05:04??SocketDemo\SocketDemo01\.project
?????文件????????1474??2011-08-29?05:04??SocketDemo\SocketDemo01\AndroidManifest.xml
............此處省略36個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源