Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 28th, 2003, 08:10 PM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Article Dicussion: Asynchronous Socket Utility Classes – Part I

If you have any questions or comments about this article please post them here.

This forum post relates to this article

Reply With Quote
  #2  
Old July 26th, 2004, 01:58 AM
zhebincong zhebincong is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 5 zhebincong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 21 sec
Reputation Power: 0
the reader's question about c# client + java server

hello

i am a java programmer,i am now studying c#,i find this article about asynchrous socket is very practical,so i study it.now i have finish the part1(that is a clientside).

it works well to connect to any website(just as "www.continuumtechnologycenter.com"),then i try to coorperate the asynchronous c# socket client with a simple java socket server(that is a echo server),the java server code as following:

ServerSocket serverSocket = new ServerSocket(10000);
while (true) {
Socket socket = serverSocket.accept();
PrintWriter out =
new PrintWriter(socket.getOutputStream(), true);
BufferedReader in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
out.println("you have connected");
String input;
while((input=in.readLine())!=null){
System.out.println(input);
out.println(input);
}
System.out.println("out of while loop");


i modify the "TestClient()" in the client side as following:


CSocketClient pSocketClient=new CSocketClient(10240,null,
new CSocketClient.MESSAGE_HANDLER(MessageHandlerClient ),
new CSocketClient.CLOSE_HANDLER(CloseHandler),
new CSocketClient.ERROR_HANDLER(ErrorHandler));
pSocketClient.Connect("localhost",10000);
pSocketClient.Send("hello world");
Console.ReadLine();
pSocketClient.Disconnect();
Console.ReadLine();
pSocketClient.Dispose();

then i start the java server,and c# client,from the client side console,i can see:



you have connected


from the server side console,the following is printed:

hello world
out of while loop

it mean that the java server can send "you have connected" to c# client,and the client can send "hello world" to the server,the server side can echo the "hello world" back to the client,but why "hello world" that is echoed back from server can't be printed in the client side console?i wonder if the asynchronous c# socket can works well with the java socket?

help me,thank you!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Dicussion: Asynchronous Socket Utility Classes – Part I


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway