当前位置: 技术问答>java相关
用java的tcp连接能传对象吗?比如我想传一个resultMetaData!!如果能,具体怎么做?
来源: 互联网 发布时间:2015-04-24
本文导语: 用java的tcp连接能传对象吗?比如我想传一个resultMetaData!!如果能,具体怎么做? | 传Vector行: import java.io.*; import java.net.*; import java.util.Vector; public class TestSocketServer { ServerSocket mServerSo...
用java的tcp连接能传对象吗?比如我想传一个resultMetaData!!如果能,具体怎么做?
|
传Vector行:
import java.io.*;
import java.net.*;
import java.util.Vector;
public class TestSocketServer
{
ServerSocket mServerSocket = null;
Socket mSocket = null;
DataInputStream dis = null;
DataOutputStream dos = null;
Vector mVector = null;
public TestSocketServer()
{
try
{
mServerSocket = new ServerSocket(9009,15);
mSocket = mServerSocket.accept();
dis = new DataInputStream(mSocket.getInputStream());
ObjectInputStream ois = new ObjectInputStream(dis);
mVector = (Vector)ois.readObject();
for(int i = 0 ; i
import java.io.*;
import java.net.*;
import java.util.Vector;
public class TestSocketServer
{
ServerSocket mServerSocket = null;
Socket mSocket = null;
DataInputStream dis = null;
DataOutputStream dos = null;
Vector mVector = null;
public TestSocketServer()
{
try
{
mServerSocket = new ServerSocket(9009,15);
mSocket = mServerSocket.accept();
dis = new DataInputStream(mSocket.getInputStream());
ObjectInputStream ois = new ObjectInputStream(dis);
mVector = (Vector)ois.readObject();
for(int i = 0 ; i