Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Java in comparison to C++ Question Pin
Christian Graus18-Nov-02 18:12
protectorChristian Graus18-Nov-02 18:12 
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster18-Nov-02 18:16
Swinefeaster18-Nov-02 18:16 
GeneralRe: Java in comparison to C++ Question Pin
S van Leent19-Nov-02 7:31
S van Leent19-Nov-02 7:31 
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster18-Nov-02 18:24
Swinefeaster18-Nov-02 18:24 
GeneralRe: Java in comparison to C++ Question Pin
Christian Graus18-Nov-02 18:59
protectorChristian Graus18-Nov-02 18:59 
GeneralRe: Java in comparison to C++ Question Pin
Joaquín M López Muñoz18-Nov-02 19:57
Joaquín M López Muñoz18-Nov-02 19:57 
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster18-Nov-02 20:17
Swinefeaster18-Nov-02 20:17 
GeneralRe: Java in comparison to C++ Question Pin
Joaquín M López Muñoz18-Nov-02 20:52
Joaquín M López Muñoz18-Nov-02 20:52 
Thanks Joaquin. So in the code I posted, when the function returns, the new socket object created by ListenSocket.accept() will be deleted once the TheClientSocket local reference (?) variable goes out of scope, correct?

No, it'll be deleted when the garbage collector decides to sweep it off. Whether the socket itself, as a system resource, gets released, depends on the Finalize method of Socket (I think).

I guess then the only way to implement this would be to go "return TheClientSocket" instead of the boolean, and pass it back to the caller in that manner?

This is a way. Another is to have a wrapper class around Socket and pass this to the function:
class SocketWrapper
{
  SocketWrapper(Socket socket_)
  {
    socket=socket_;
  }
  public Socket socket;
}
...
public boolean receiveAndUnmarshallInvoke(CRmiInvokeMessage InvokeMessage,
ServerSocket ListenSocket, SocketWrapper TheClientSocket)
{
boolean success = false;

if(TheSocket == null)
{
System.err.println("Null TheSocket passed in CRmiCommunicator.receiveAndUnmarshallInvoke().");
}
else
{
TheClientSocket.socket = ListenSocket.accept();
}

return success;
}
...
Socket clientSocket;
receiveAndUnmarshallInvoke(...,new SocketWrapper(clientSocket));





Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster18-Nov-02 21:21
Swinefeaster18-Nov-02 21:21 
GeneralRe: Java in comparison to C++ Question Pin
Joaquín M López Muñoz18-Nov-02 21:59
Joaquín M López Muñoz18-Nov-02 21:59 
GeneralRe: Java in comparison to C++ Question Pin
S van Leent19-Nov-02 7:36
S van Leent19-Nov-02 7:36 
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster18-Nov-02 21:58
Swinefeaster18-Nov-02 21:58 
GeneralRe: Java in comparison to C++ Question Pin
Alexandru Savescu19-Nov-02 4:18
Alexandru Savescu19-Nov-02 4:18 
GeneralRe: Java in comparison to C++ Question Pin
Alvaro Mendez19-Nov-02 5:25
Alvaro Mendez19-Nov-02 5:25 
GeneralRe: Java in comparison to C++ Question Pin
Swinefeaster19-Nov-02 14:29
Swinefeaster19-Nov-02 14:29 
GeneralMouse hover question Pin
David Ensminger18-Nov-02 16:42
David Ensminger18-Nov-02 16:42 
Generala question about two CPU... Pin
liuty200618-Nov-02 16:27
liuty200618-Nov-02 16:27 
GeneralRe: a question about two CPU... Pin
Christian Graus18-Nov-02 16:59
protectorChristian Graus18-Nov-02 16:59 
GeneralRe: a question about two CPU... Pin
liuty200618-Nov-02 17:57
liuty200618-Nov-02 17:57 
GeneralRe: a question about two CPU... Pin
Christian Graus18-Nov-02 18:01
protectorChristian Graus18-Nov-02 18:01 
Questiontrigger erase of background? Pin
Anonymous18-Nov-02 16:25
Anonymous18-Nov-02 16:25 
AnswerRe: trigger erase of background? Pin
Christian Graus18-Nov-02 16:36
protectorChristian Graus18-Nov-02 16:36 
GeneralRe: trigger erase of background? Pin
Anonymous18-Nov-02 16:47
Anonymous18-Nov-02 16:47 
GeneralRe: trigger erase of background? Pin
Christian Graus18-Nov-02 16:57
protectorChristian Graus18-Nov-02 16:57 
GeneralRe: trigger erase of background? Pin
Anonymous18-Nov-02 19:08
Anonymous18-Nov-02 19:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.