我正在为我的项目开发一个网站。我是Asp.net和这个论坛的新手。我的项目是从网站控制一个主导。
我正在使用网络模块来连接我的微控制器和web服务器。我想做的是将变量从ASP.net发送到网络模块的IP地址。
非常感谢大家能帮助我,这里是ASP代码(page.aspx.cs)。
public partial class VirtualRemote : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// when this button is click i want to send a variable example "A"
to network module IP example 192.168.1.2. so network module can pass the
variable to microC , i already have microC program to receive from network module
}
}发布于 2011-06-14 15:15:55
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
clientSocket.Connect(new IPEndPoint(IPAddress.Parse("192.168.1.2"), PORT_NUMBER));
// Send the file name.
var A = "TEST STRING";
clientSocket.Send(Encoding.UTF8.GetBytes(A));有关Socket类的更多信息
https://stackoverflow.com/questions/6340129
复制相似问题