我尝试使用命令行参数传递大量数据,但我只获得一行数据。我没有得到剩余的数据。
以下是发送程序的代码:
zpl = Printer.GetZPLString(json, true, true);
const string path = @"E:\karthik related\EXEC PROGRAMS\PrintServerHost\PrintServerHost\bin\Debug\PrintServerHost.exe";
string Ip = PrintersList[0].IPAddress.ToString();
string port = PrintersList[0].PortNumber.ToString();
string zp = zpl;
Process.Start(path, Ip + " " + port + " " + zp);
这是接收程序:
private void Form1_Load(object sender, EventArgs e)
{
string[] args = Environment.GetCommandLineArgs();
if (args.Length > 1)// && (args[1].StartsWith("/n")))
{
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
client.Connect(args[1], Convert.ToInt16(args[2]));
System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream());
writer.Write(args[3]);
writer.Flush();
writer.Close();
client.Close();
}
}
任何人都可以提出问题所在。