import java.awt.*;
import java.net.*;
import java.applet.*;
import java.io.*;
public class TCPClient extends Applet
{
Socket sock;
DataInputStream in;
PrintStream out;
public void init()
{
resize(300,400);
}
public void start()
{
try
{
sock=new Socket(getDocumentBase().getHost(),4700);
in=new DataInputStream(sock.getInputStream());
out=new PrintStream(sock.getOutputStream());
}
catch(IOException e)
{
System.out.println(" Client error!");
}
String tempstr="Select * from AI where AIMark='主变电压'";
out.println(tempstr);
try
{
String s=in.readLine();
if(s!=null)
System.out.println(s);
else
this.stop();
}
catch(IOException e)
{
}
}
public void stop()
{
try
{
sock.close();
}
catch(IOException e)
{
}
}
}
import java.net.*;
import java.applet.*;
import java.io.*;
public class TCPClient extends Applet
{
Socket sock;
DataInputStream in;
PrintStream out;
public void init()
{
resize(300,400);
}
public void start()
{
try
{
sock=new Socket(getDocumentBase().getHost(),4700);
in=new DataInputStream(sock.getInputStream());
out=new PrintStream(sock.getOutputStream());
}
catch(IOException e)
{
System.out.println(" Client error!");
}
String tempstr="Select * from AI where AIMark='主变电压'";
out.println(tempstr);
try
{
String s=in.readLine();
if(s!=null)
System.out.println(s);
else
this.stop();
}
catch(IOException e)
{
}
}
public void stop()
{
try
{
sock.close();
}
catch(IOException e)
{
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货