Re: Newcomer's CAsyncSocket example: trouble connecting with other clients



stephen park wrote:


Console::WriteLine( "Sending message" );

>

TcpClient^ client = gcnew TcpClient( IP, PORT );

>

NetworkStream ^stream = client->GetStream();

String^ msg = "hello there";
array<Byte>^data = Text::Encoding::ASCII->GetBytes( msg );

try {
stream->Write( data, 0, data->Length );
stream->Flush();
}
catch( Exception ^e) {
Console::WriteLine( e->StackTrace );
}
client->Close();

Nothing really seems to jump out at me, but maybe someone else can see
something?


Well, you are writing then closing immediately, thus killing the transmission before it is even finished.

Try this:

Console::WriteLine(L"- Connecting");

TcpClient^ clnt = gcnew TcpClient( YOUR_IP, YOUR_PORT);

Console::WriteLine(L"- Connected. PAK to close");
Console::ReadKey();

clnt->Close();

Console::WriteLine(L"- Closed. PAK to exit");
Console::ReadKey();

Throw in some PAKs (Press Any Key) to give time to work. :)

--
HLS
.



Relevant Pages

  • Re: MetroidRL 0.7DRL Released
    ... the elevation of the initial jump must be being ... Start up a new game so that you are outside on the rocky ground. ... unmanaged exception relating to the Music manager being running on ... (unless the uncaught exception behaviour is overridden again). ...
    (rec.games.roguelike.development)
  • Re: Exception Handling...
    ... >HandleZeroDivide and some other stuff I don't understand being pushed on ... private data on top of the Exception Registration... ... But why would it go there if the registration on the stack points to your ... >the jump to HandleZeroDivide, followed by the normal exit code. ...
    (comp.lang.pascal.delphi.misc)
  • Re: n1298 try/catch revisited?
    ... > exception package with macros. ... A nested function can jump to a label inherited from a ... provided the label was explicitly ...
    (comp.std.c)
  • Re: possible to skip code from sub functions?
    ... Do this without an exception or a return value on any function: ... void B ... Jump j = new Jump; ... Or make it jump back to the scope level ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Triki, Ace, Eki and Paolo are gone from Disco
    ... or are the rats leaving the sinking ship? ... they pushed or did they jump? ... With the exception of Ekimov, ...
    (rec.bicycles.racing)