Code snippets


Code snippets

เนื่องจากช่วงนี้ ห่างหายจาก SIP & IMS พอสมควร เพราะมัวไปทำ Graph traversal กับ JXTA P2P อยู่นิดหน่อย ขอเอา code มา ฝากไว้ที่นี้ก่อนกันลืมครับ

Graph Traversal (BFS and DFS) and Dijkstra Shortest Path 
(Original from CodeProject.com  http://www.codeproject.com/KB/java/BFSDFS.aspx)
Read NS2 trace
I created this program for reading a NS2 topology file and put them in edge variables for creating a graph topology. 
Jxta Multicast (JXTA 2.5)
#1 To demonstrate how to send message between client and server using Jxta network
(Original from https://jxta.dev.java.net/ )
#2 To create simple chat message

-  Graph Traversal (BFS & DFS) and Dijkstra Shortest Path
Graph Traversal (BFS & DFS) and Dijkstra Shortest Path (Original from CodeProject.com http://www.codeproject.com/KB/java/BFSDFS.aspx)
Download: http://gotoknow.org/file/wwarodom/GraphTraversal-ShortestPath.zip

Read NS2 topology file
NS2 topology files can be generated by several topology generators (e.g., GT-ITM, BRITE, Tiers, I-net 3.0). I created this program for reading a NS2 topology file and put them (node connection) in edge variables (graph data structure) for creating a graph.
Download:  http://gotoknow.org/file/wwarodom/ReadNS2-Topology.zip

- Jxta Multicast (JXTA 2.5)
Jxta Multicast, there are 2 projects:
#1)  To demonstrate how to send simple message between client and server using Jxta network (Original from https://jxta.dev.java.net/ )
#2)  I created simple chat GUI using multicast via Jxta network.  Server can send back an unicast message to a lastest client who is communicated with the server.  

To compile:
C:\JxtaMulticastChat> javac -classpath ../lib /jxta.jar;../lib/bcprov-jdk14.jar pleX/*.java

To run:
C:\JxtaMulticastChat>java -classpath ../lib/jxta.jar;../lib/bcprov-jdk14.jar;. pleX.JxtaMulticastChat

To test:
- Run program ->  Setup -> Start Server
- Run another instance (client) -> Setup -> Start Client  (You can run at the same or different machine)
- Start to chat between them (press Ctrl + Enter to send a message).
- You can start many clients and run as clients to see how messages are propagated via the multicast socket but you can run only one server.
- At Server mode, you can choose "Send mode" menu that uses to reply back to an only lastest communicated client (for unicast mode) or reply to all connected clients (for broadcast).

Download: http://gotoknow.org/file/wwarodom/JxtaMulticast.zip

any question, feel free to leave me a comment.  :-)

คำสำคัญ (Tags): #graph traversal#jxta#ns2#p2p
หมายเลขบันทึก: 401471เขียนเมื่อ 7 ตุลาคม 2010 21:54 น. ()แก้ไขเมื่อ 19 มิถุนายน 2012 19:38 น. ()สัญญาอนุญาต: สงวนสิทธิ์ทุกประการจำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (0)

ไม่มีความเห็น

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท