壁画不多说 客户端: import java . io . * ; import java . net . Socket ; public class UploadPicClient { public static void main ( String [ ] args ) throws IOException { //1,创建socket Socket s = new Socket ( "192.168.43.5" , 10007 ) ; //我的Ip地址是192.168.43.5,自己传自己 //2,读取源图片。 File picFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( picFile ) ; //3,目的是socket输出流。 OutputStream out = s . getOutputStream ( ) ; byte [ ] buf = new byte [ 1024 ] ; int len = 0 ; while ( ( len = fis . read ( buf ) ) != - 1 ) { out . write ( buf , 0 , len ) ; //告诉服务器端图片数据发送完毕,不要等着读了。 s . shutdownOutput ( ) ; /** *