I am a beginner of the Beepcore-Java API and this API is a part of my
university senior design project.But i have a problem.
I try to write a simple client-server (initiator-listener actually)
application. Server side first creates TLS and ECHO profiles then listens
for an incoming connection. Client side connects to the Server. Client side
first creates a Session then TLS and ECHO. After completing session, TLS and
ECHO connection ,Client simply sends a String to the Server and Server
prints this string to the console. I use sendMSG in the client and i believe
receiveMSG should be implemented in the Server. But my problem is i can not
find a way that how receiveMSG should be implemented.
Client side codes
-----------------------
session = TCPSessionCreator.initiate(host, port); // session creation
session = TLSProfile.getDefaultInstance().startTLS((TCPSession) session); //
TLS creation
channel = session.startChannel(EchoProfile.ECHO_URI); // Echo channel
creation
channel.sendMSG(new StringOutputDataStream(request),reply); // sending
message( request is a string)
Here in client side using below code i can reach and print string (request)
but this is not my goal!!!
InputStream is = reply.getNextReply().getDataStream().getInputStream();
Server side codes
-----------------------
uri = "http://iana.org/beep/TLS";
className ="org.beepcore.beep.profile.tls.jsse.TLSProfileJSSE";
SessionTuningProperties tuning = null;
p = (Profile) Class.forName(className).newInstance();
profileConfig = new ProfileConfiguration();
startChannelListener = p.init(uri, profileConfig);
reg.addStartChannelListener(uri,startChannelListener,tuning); // TLS
registered
uri = "http://xml.resource.org/profiles/NULL/ECHO";
className ="org.beepcore.beep.profile.echo.EchoProfile";
p = (Profile) Class.forName(className).newInstance();
profileConfig = new ProfileConfiguration();
startChannelListener = p.init(uri, profileConfig);
reg.addStartChannelListener(uri,startChannelListener,tuning); // ECHO
registered
TCPSessionCreator.listen(port, reg); // listening for a connection
I use Beepd and Bing examples as a reference.
I think i need to use MessageListener interface and receiveMSG but due to
lack of sample codes i can not progress in my project.I am really looking
forward to your answer and thank for your help.
Is there any web site or source including example code using BeepCore-Java
API?
ORCUN SEDEN
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
|