Copy link to clipboard
Copied
Hi,
I'm using Boost Asio library to send data to the server over TCP in my plugin. Here is piece of code I'm trying to run from Render() function:
boost::asio::io_service aios;
boost::asio::ip::tcp::endpoint ep(boost::asio::ip::address::from_string("127.0.0.1"), 8000); // use localhost and port 8000
boost::asio::ip::tcp::socket sock(aios);
sock.connect(ep);
sock.send(boost::asio::buffer(message));
This code crashes in the last line with the following error message: "The system detected an invalid pointer address in attempting to use a pointer argument in a call".
In the same time this code works fine from the standalone application. Moreover, if I run this standalone applicaion as a child process from Render() function, all things work correctly.
What may be the reason of the described behavior?
Thanks,
Ilia
Copy link to clipboard
Copied
Ping... Can anyone help with this issue?
Copy link to clipboard
Copied
Adobe application may use the ports 8000 and onwards for debugging, opening a listening port for that on their NodeJS instance I think if activated. Maybe that is what is causing your problems. Have your tried using another port, e.g. in the 20000+ area?
Copy link to clipboard
Copied
Thanks, Toby, for your answer!
I tried another port (20100) but result is the same ("The system detected an invalid pointer address in attempting to use a pointer argument in a call").
Interesting that this code (with any port) works on Mac without any problem, so it's only Windows issue. Another interesting point: if I compile this piece of code as standaloge application and run this app from Render() function (as a child process) it works correctly (even with port 8000)...
Copy link to clipboard
Copied
Another random try: run cmd.exe as an administrator and type the following command: netsh winsock reset
Copy link to clipboard
Copied
As for the actual error, it seems it is the description for the Winsock error code WSAEFAULT when using bind().
Check this link: bind Function (Windows)
"This error is returned if the name parameter is NULL, the name or namelen parameter is not a valid part of the user address space, the namelen parameter is too small, the name parameter contains an incorrect address format for the associated address family, or the first two bytes of the memory block specified by name do not match the address family associated with the socket descriptor s."
It is commonly thrown when trying to use an IPv6 address on an IPv4 descriptor and vice-versa.
I haven't used boost/asio in quite a while, but try using this in your third line:
boost::asio::ip::tcp::socket sock(aios, ep.protocol());
Copy link to clipboard
Copied
Thanks, Toby!
I solved this problem by using WinSock code (which also works on Mac, you just have to include another header files). I tried to use netsh winsock reset and ep.protocol() but it didn't help with Boost...