I have been following useful examples on establishing TCP socket listeners, but I am having serious problems with the implementation.
Essentially, I define a FSocket pointer as a member variable in the header of my class, but whenever I try to set it in the cpp file I get a write access violation because it is a null pointer.
FSocket* newSocket = socketBuilder.Build();
m_listenerSocket = newSocket;
The variable ‘newSocket’ is created fine, but as soon as I try to assign it to ‘m_listenerSocket’ I get the following error message: “Exception thrown: write access violation. this was nullptr.”. I’ve tried replacing the line shown in the header file with:
FSocket* m_listenerSocket = 0;
FSocket* m_listenerSocket = nullptr;
Because I know some compilers can get fussy about that, but no matter what I try nothing works.