Hello,
I have to develop a functionality to send data to an IP-address & port. In AX 2012 it works however in 4.0 it doesn't. My example job:
static void ALP_SocketTest(Args _args)
{
System.Net.IPAddress address;
System.Net.IPEndPoint endPoint;
System.Net.Sockets.Socket socket;
str contents;
void sendCommand(str _command)
{
System.Text.Encoding ascii;
CLRObject bytes;
int result;
;
ascii = System.Text.Encoding::get_ASCII();
bytes = ascii.GetBytes(_command + '\n');
socket.Send(bytes);
}
socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily::InterNetwork,|
System.Net.Sockets.SocketType::Stream, System.Net.Sockets.ProtocolType::Tcp);
address = new System.Net.IPAddress(588384778);
endPoint = new System.Net.IPEndPoint(address, 9100);
socket.Connect(endPoint);
sendCommand(contents);
socket.Close();
}
In this form I get the compile error "*** Error: 73, The class %1 does not contain this function" for the first line marked red. If I comment out this line (socket.Send(bytes);) I get a compile error in the second line marked red: "*** Error: -1, Syntax error.", the cursor then stands at the place marked with the black vertical line above.
I'm completely open to either use this approach to connect and send the data or another if that would be better/easier. Has anyone an idea how to solve this...?
Regards
Patrick
*This post is locked for comments
I have the same question (0)