Jump to content

YoussefGamil

Member
  • Posts

    54
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Egypt

Everything posted by YoussefGamil

  1. That's exactly what I was thinking... There is no such thing as a <javascript> tag... I was searching for this and I belived that there is not any tag called "<javascript>". But,..Infact I found a document in other forum talking about this tag and using it to make a connection with a Socket Server...This can help me to make something like chat!! Take a look at this simple code: -------------------------------------------- <category>=0A= <pattern>WHAT DOES * MEAN</pattern>=0A= <template>=0A= <javascript>=0A= <![CDATA[=0A= word =3D new = String(Packages.org.alicebot.server.core.Graphmaster.INPUT_STAR); if (word.indexOf(" ") > 0) word =3D word.substr(0, word.indexOf(" ")); retStr =3D "No definitions found for: '" + word + "'"; server =3D "dict.org";=0A= port =3D 2628; socket =3D new java.net.Socket(server,port);=0A= socket.setKeepAlive(true);=0A= socket.setSoTimeout(5000); outBuff =3D new java.lang.StringBuffer();=0A= lineIn =3D new java.lang.String();=0A= inReader =3D new java.io.InputStreamReader(socket.getInputStream());=0A= response =3D new java.io.BufferedReader(inReader); cmdOut =3D new java.io.PrintWriter(socket.getOutputStream(), true);=0A= cmdOut.println("define * " + word + "\n"); lineIn =3D response.readLine(); if (lineIn.startsWith("220") =3D=3D false) { if (lineIn.startsWith("420")) retStr +=3D ".<br />Server temporarily unavailable!<br />"; else if (lineIn.startsWith("421")) retStr +=3D ". <br />Server shutting down at operator request!<br = />"; else retStr +=3D ".<br />Cannot access dictionary or server access = denied!<br />"; } else { lineIn =3D response.readLine(); if (lineIn.startsWith("150")=3D=3D true) { while ((lineIn =3D response.readLine()) !=3D null) { if (lineIn.startsWith("151")) { x =3D lineIn.indexOf(" "); x =3D lineIn.indexOf(" ", x+1); x =3D lineIn.indexOf(" ", x+1); outBuff.append("From: "+ lineIn.slice(x) + "<br /><br />"); continue; } if (lineIn.startsWith("250")) break; if (lineIn.startsWith(".")) {=0A= if (lineIn.startsWith("..")) outBuff.append(lineIn.slice(1) + "<br />"); continue; } if (lineIn.startsWith(".")) continue; =0A= outBuff.append(lineIn + "<br />");=0A= } retStr =3D String(outBuff); } else { cmdOut.close();=0A= response.close();=0A= socket.close(); socket =3D new java.net.Socket(server,port);=0A= socket.setKeepAlive(true);=0A= socket.setSoTimeout(5000);=0A= inReader =3D new java.io.InputStreamReader(socket.getInputStream());=0A= response =3D new java.io.BufferedReader(inReader); cmdOut =3D new java.io.PrintWriter(socket.getOutputStream(), true);=0A= cmdOut.println("match * . " + word + "\n");=0A= lineIn =3D response.readLine(); if (lineIn.startsWith("220") =3D=3D false) { if (lineIn.startsWith("420")) retStr +=3D ".<br />Server temporarily unavailable!<br />"; else if (lineIn.startsWith("421")) retStr +=3D ". <br /> Server shutting down at operator = request!<br />"; else retStr +=3D ".<br /> Server access denied!<br />"; } else { lineIn =3D response.readLine(); if (lineIn.startsWith("152")=3D=3D true) { while ((lineIn =3D response.readLine()) !=3D null) {=0A= if (lineIn.startsWith(".")) continue;=0A= if (lineIn.startsWith("250")) break; outBuff.append("<br />" + lineIn.slice(lineIn.indexOf(" ")));=0A= } retStr +=3D ", perhaps you mean:" + outBuff + "<br />"; } else { if (lineIn.startsWith("552"))=0A= retStr +=3D "."; else if (lineIn.startsWith("550")) retStr +=3D ".<br /> Invalid dictionary match database!<br />"; else=0A= if (lineIn.startsWith("551")) retStr +=3D ".<br /> Invalid dictionary match strategy!<br />"; } } } cmdOut.println("QUIT\n"); while ((lineIn =3D response.readLine()) !=3D null) =0A= if (lineIn.startsWith("221")) break;=0A= } cmdOut.close();=0A= response.close();=0A= socket.close(); retStr;=0A= ]]>=0A= </javascript>=0A= </template>=0A= </category>=0A=
  2. OH..NOO Sorry for my crazy question... but, all I want that how to use "<javascript>" to call java.net.SocketServer in other meaning I want to use it because I do not want to use Java Applet. What is difference between <script lanuage="JavaScript"> and <javascript> ? and can it call Java function (ex: java.awt.*) that's what you mean!! Did you understand?
  3. Hi, What does "<javascript>" written as a tag?Pls help me.. If I knew how does it work,It will be easy form me to create Socket Server.
  4. Hi, I want to creat Socket Server by using JavaScript.. Can any one help me? _____________________ Iam new in is forum.. Youssef Gamil,14 years old. website:http://www.egysite.com/yssef/
  5. Hi, I want to creat Socket Server by using JavaScript.. Can any one help me? _____________________ Iam new in is forum.. Youssef Gamil,14 years old. website:http://www.egysite.com/yssef/
×
×
  • Create New...