Hello all,

I try to implement the socket programming which can send data to server. But when I send data to server, server can receive data but my emulator is closed immediately. I try to fix this for a day, I found that I happen because the code that attempt to connect to server like this:
User::LeaveIfError(iSocketServ.Connect());

// Open the socket
User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream,KProtocolInetTcp));

//Connect the socket (has problem)
connectInetAddr.SetAddress(KInetAddr);

connectInetAddr.SetPort(2500); //TLS port

iSocket.Connect(connectInetAddr,iStatus);


iSocket.Close();
iSocketServ.Close();
Please suggest me why it happens and advice another solution to connect server for me

Thanks a lot
Guide