我用Nokia MMS Library发送彩信,完全是按sample文件夹下面的OriginatingApp的例子运行的,但是 总是在MMSender中的
connection.getResponseCode()处报错,
win7 系统 报的是
Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:147)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at com.nokia.mms.MMSender.send(MMSender.java:172)
at com.nokia.mms.MMSender.send(MMSender.java:99)
at com.emay.nokia.send.OriginatingApp.<init>(OriginatingApp.java:30)
at com.emay.nokia.send.OriginatingApp.main(OriginatingApp.java:141)
Connection reset xp系统报的是
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064)Connection reset
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at com.nokia.mms.MMSender.send(MMSender.java:172)
at com.nokia.mms.MMSender.send(MMSender.java:99)
at com.emay.nokia.send.OriginatingApp.<init>(OriginatingApp.java:26)
at com.emay.nokia.send.OriginatingApp.main(OriginatingApp.java:138)
我将xp和win7的防火墙也全部关闭了,telnet 10.0.0.172 80 也是没问题的,nokia的包换了两个了,都不好使,求助一下大家这个东东是怎么造成的。
构造方法:
public OriginatingApp() {
MMMessage mm = new MMMessage();
SetMessage(mm);
AddContents(mm);
MMEncoder encoder = new MMEncoder();
encoder.setMessage(mm);
try {
encoder.encodeMessage();
byte[] out = encoder.getMessage();
for (int i = 0; i < out.length; i++) {
System.out.print(out[i]+" ");
}
MMSender sender = new MMSender();
sender.setMMSCURL("http://mmsc.monternet.com");
sender.addHeader("X-NOKIA-MMSC-Charging", "100");
MMResponse mmResponse = sender.send(out);
System.out.println("Message sent to " + sender.getMMSCURL());
System.out.println("Response code: " + mmResponse.getResponseCode()
+ " " + mmResponse.getResponseMessage());
Enumeration keys = mmResponse.getHeadersList();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = (String) mmResponse.getHeaderValue(key);