Results 1 to 1 of 1
Thread: servlet client help for newbie
- 10-29-2007, 04:25 PM #1
Member
- Join Date
- Oct 2007
- Posts
- 4
- Rep Power
- 0
servlet client help for newbie
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?
Similar Threads
-
How to run Spring Client in a Servlet
By Java Tip in forum Spring FrameworkReplies: 0Last Post: 04-02-2008, 10:33 AM -
Identify Client in Socket Client Server Application
By masadjie in forum NetworkingReplies: 1Last Post: 12-20-2007, 09:18 AM -
Client servlet help please
By heyhey in forum New To JavaReplies: 1Last Post: 11-01-2007, 05:11 PM -
How to run Spring Client in a Servlet
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:19 PM -
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2
By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks