关于vs.net三层结构socket能传送xml吗?
来源:百度知道 编辑:UC知道 时间:2024/09/20 20:19:12
完全可以,SOCKET传送的是BYTE[],任何类型的数据都是可以转化为BYTE[]的
序列化后再传.. 传过之后再反序列化
当然可以,MSDN上都有例子的!
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
public class mySocket
{
private static Socket connectSocket(string server, int port)
{
Socket s = null;
IPHostEntry iphe = null;
try
{
// Get host related information.
iphe = Dns.Resolve(server);
// Loop through the AddressList to obtain the supported AddressFamily. This is to avoid
// an exception to be thrown if the host IP Address is not compatible with the address family
// (typical in th