https://www.scribd.com/doc/270839166/SB ... nual-v3-03
Webform1.cs:
Код: Выделить всё
public string ip = "192.168.1.109";
protected void Button_click(object sender, EventArgs e)
{
try
{
bool status = sbxpc.SBXPCDLL.ConnectTcpip(1, ip, 5005, 0);
if (status)
{
bool ss = sbxpc.SBXPCDLL.GetSerialNumber(1, out ip);
Button1.Text = "connected";
Response.Write("success" + ip);
}
}
catch (Exception ee)
{
Response.Write(ee);
}
}
Код: Выделить всё
[DllImport("SBXPCDLL.dll", CallingConvention = CallingConvention.Winapi)]
static extern byte _ConnectTcpip(Int32 dwMachineNumber, ref IntPtr lpszIPAddress, Int32 dwPortNumber, Int32 dwPassWord);
public static bool ConnectTcpip(Int32 dwMachineNumber, string lpszIPAddress, Int32 dwPortNumber, Int32 dwPassWord)
{
if (lpszIPAddress == null)
return false;
IntPtr string_in = Marshal.StringToBSTR(lpszIPAddress);
try
{
byte ret = _ConnectTcpip(dwMachineNumber, ref string_in, dwPortNumber, dwPassWord);
return ret > 0;
}
catch (Exception)
{
return false;
}
finally
{
Marshal.FreeBSTR(string_in);
}
}
Подробнее здесь: https://stackoverflow.com/questions/514 ... e-with-sdk