|
-
Mar 6th, 2004, 09:22 PM
#1
Thread Starter
yay gay
Why this socket code doesnt work?
Code:
TcpClient client = new TcpClient();
client.Connect("127.0.0.1", 21);
client.GetStream().BeginRead(buffer, 0, buffer.Length, new AsyncCallback(ReadCallBack), null);
Code:
static void ReadCallBack(IAsyncResult callback) {
int res = stream.EndRead(callback);
if (res == 0) {
return;
}
string str = Encoding.Default.GetString(buffer);
Console.WriteLine(str);
I don't understand why it doesnt work. It should connect to my ftp(and it does as i can see it in my ftp server) and receive a "Bullet ftp serv" message but it doesn't!
The problem seems to be that the ReadCallBack method doesnt even get fired..but why?!
\m/  \m/
-
Mar 6th, 2004, 09:44 PM
#2
static void ReadCallBack(IAsyncResult callback)
You didn't supply an argument to that function...
VB Code:
client.GetStream().BeginRead(buffer, 0, buffer.Length, new AsyncCallback(ReadCallBack([b]something_here[/b])), null);
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Mar 6th, 2004, 09:57 PM
#3
Thread Starter
yay gay
No. Its a function pointer, its the BeginRead() function's work to fill it with the needed parameter not to me.
The problem shouldn't be there (as i am not even allowed to put an arg there)
\m/  \m/
-
Mar 7th, 2004, 10:45 AM
#4
Thread Starter
yay gay
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|