하지만 i'am 예외가 점점 :이 (J2ME) 해결 방법 : javax.microedition.io.ConnectionNotFoundException : 오류 0 소켓 :: 열기를
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import com.sun.lwuit.*;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
public class MyMidlet extends MIDlet implements Runnable {
Form f;
TextField t1 ;
Label label1 ;
Button b1;
TextField tfNom ;
TextField tfPrenom ;
//Connexion
HttpConnection hc;
DataInputStream dis;
String url ;
StringBuffer sb ;
int ch;
public MyMidlet() {
Display.init(this);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
f = new Form("Test");
tfNom = new TextField("nom : ");
tfPrenom = new TextField("prenom :");
b1=new Button("ok");
f.addComponent(tfNom); // append
f.addComponent(tfPrenom);
f.addComponent(b1);
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.out.println("gooooo");
url= "http://localhost/J2ME/ajout.php";
sb = new StringBuffer();
//****************************
try {
hc = (HttpConnection) Connector.open(url+"?nom="+tfNom.getText()+"&prenom="+tfPrenom.getText());
dis = new DataInputStream(hc.openDataInputStream());
while ((ch = dis.read()) != -1) {
sb.append((char)ch);
}
// trim tna77i les espaces
if ("successfully added".equalsIgnoreCase(sb.toString().trim())) {
System.out.println("succes (added)");
}else{
System.out.println("Error While Adding Data");
}
} catch (IOException ex) {
ex.printStackTrace();
}
//***********************
System.out.println("I am Ouuuut");
}
});
f.show();
}
public void run() {
}
}
을
-> 작동하지 않고 예외가 발생했습니다 : 처음으로 NOKIA DevEnv를 사용합니다. 그것은 정상 Netbeans J2ME에서 그것을 사용할 때 일하는 것이 었습니다. 아무도 도와 줄 수 있습니까?
gooooo
javax.microedition.io.ConnectionNotFoundException: error 0 in socket::open
- com.sun.midp.io.j2me.socket.Protocol.open0(), bci=0
- com.sun.midp.io.j2me.socket.Protocol.connect(), bci=143
- com.sun.midp.io.j2me.socket.Protocol.open(), bci=122
- com.sun.midp.io.j2me.socket.Protocol.openPrim(), bci=4
- com.sun.midp.io.j2me.http.Protocol.createConnection(), bci=13
- com.sun.midp.io.j2me.http.Protocol.connect(), bci=138
- com.sun.midp.io.j2me.http.Protocol.streamConnect(), bci=53
- com.sun.midp.io.j2me.http.Protocol.startRequest(), bci=7
- com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=33
- com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=3
- com.sun.midp.io.j2me.http.Protocol.openInputStream(), bci=6
- com.sun.midp.io.ConnectionBaseAdapter.openDataInputStream(), bci=5
- esprit.MyMidlet$1.actionPerformed(MyMidlet.java:89)
- com.sun.lwuit.util.EventDispatcher.fireActionSync(EventDispatcher.java:312)
- com.sun.lwuit.util.EventDispatcher.fireActionEvent(EventDispatcher.java:257)
- com.sun.lwuit.Button.fireActionEvent(Button.java:369)
- com.sun.lwuit.Button.released(Button.java:400)
- com.sun.lwuit.Button.pointerReleased(Button.java:476)
- com.sun.lwuit.Form.pointerReleased(Form.java:2059)
- com.sun.lwuit.Component.pointerReleased(Component.java:2065)
- com.sun.lwuit.Display.handleEvent(Display.java:1643)
- com.sun.lwuit.Display.edtLoopImpl(Display.java:894)
- com.sun.lwuit.Display.mainEDTLoop(Display.java:839)
- com.sun.lwuit.RunnableWrapper.run(RunnableWrapper.java:119)
- java.lang.Thread.run(), bci=5
I am Ouuuut