Porting to Unreal from obsolete MadeWithMarmalade

As above, Ive resurrected a project, My head is now scrambled as im working Between C++, Marmalade SDK, Unreal SDK, and the original programming in Delphi,

The basic been to port most code from the Marmalade(What POS that was) As it the game was coded in C++

My biggest goal is re-using the Packet and Socket section of code as that was most complex of it, anyhow just bit of code segments, I Feel im doing it wrong badly and getting frustated at the simple stuff as ive already ported over the packet creation of it, now im stumbling over the silly socket. It nutshell, it compresses the data which is normally a char as the server looks out certain headers between the packets to identify the new one

So obviously first things first! socket creation, I was hoping to keep it simple as its pretty much a simple TCP system back and forth. was aiming to use FSocket directly but couldnt get any happy result



  //  scr->sock = s3eSocketCreate(S3E_SOCKET_TCP, 0); //So this is the org way Marmalade set socket up, dont you just love ease?

//So way i could get stuff to create the socket, well i hope i done it right here is this way, my theory so far the socket has created and connected, Ive removed error checking for now as i just wanting my server to let me know something has connected 

IPv4Address ip(212, 56, 93,149); //(212.56.93.149) A2 server IP
TSharedRef<FInternetAddr> addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
addr->SetAnyAddress();
addr->SetIp(ip.Value);
addr->SetPort(7778); // Er i think its 7778
connected = scr->sock->Connect(*addr);


//Bit further on code there call to destroy/close so i went this way
    ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(scr->sock);


So bit further on



//So in defined outBuffer was  
//char outBuffer[SIZE_OUTBUF];


//retValue = s3eSocketSend(scr->sock, scr->outBuffer+scr->outBufferPos, scr->outBufferLen-scr->outBufferPos, 0);
//Socket-to-use, const-char Buf, uint32 len, int flags
retValue = scr->sock->Send(scr->outBuffer + scr->outBufferPos, scr->outBufferLen - scr->outBufferPos, sent);


So now in my eyes Ive messed it up more on what my server is expecting and basically walked away to clear head before returning i expect its something quite simple but it bloody hiding from me at moment

Im thinking i need to rework the new RetValue i put down what it was sending with the Marmalade socket sent is just set to 0 for now

Am i barking up the wrong tree here and need to reaim my use of the Socket system ?