Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-29-2007, 07:04 PM
Member
 
Join Date: Oct 2007
Posts: 4
heyhey is on a distinguished road
java client
new to java trying to create a java udp client servlet to encode data (ascii) and be recieved by server, i have tried to write some code but not sure if it is correct and if i need to declare anything at the begining:

java.io.ObjectOutputStream
java.io.ByteArrayOutputStream

public static void main(String args[]){

//creates a string for name called Help
String s= "Help"

//Converts name into byte sequence
byte[] B = S.getBytes("US-ASCII");

//Creates a string for a number
String boot= 1234567811111111

//Convert number into byte sequence
byte[] B =CC;getbytes("US-ASCII");

//create datagram socket
aSocket = new DatagramSocket();

//Host name
InetAddress address = InetAddress.getByName("localhost")

//set port number
public function set ServerPort (3670 : int)

//create datagram packet
DatagramPacket request =
new DatagramPacket(m, args[0].length(), aHost, serverPort);
;
// Send it
aSocket.send(request);

does the code i have written convert to ascii? any problems with it?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Identify Client in Socket Client Server Application masadjie Networking 1 12-20-2007 11:18 AM
PPPoE client programming in java yeadam Networking 0 12-03-2007 02:14 AM
Client TCP in Java baltimore Networking 3 08-09-2007 10:18 PM
Telnet client Java susan Networking 1 07-30-2007 11:59 PM
a problem about java mail client program lunarstyle AWT / Swing 6 06-02-2007 01:43 AM


All times are GMT +3. The time now is 10:47 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org