亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nokiasender.java

?? mmslib1.0 支持彩信制作、解析
?? JAVA
字號:
/**
 * MMSLIB - A Java Implementation of the MMS Protocol
 * Copyright (C) 2004 Simon Vogl 
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package at.jku.soft.mms.nokia;

import java.util.*;
import net.sourceforge.jwap.wsp.*;
import java.net.*;
import java.io.*;
import net.sourceforge.jwap.util.*;
import java.lang.*;


import com.nokia.mms.*;

public class NokiaSender implements IWSPUpperLayer{

   // the URL of the WAP-Gateway and its port.
   private InetAddress wapgw;
   private int wapgwport;

   // the URI of the server to post to
   private String posturi;

   // the bytes to be posted
   private byte[] bytes;
   private String contentType;

   // holds the WAP session we open to send the message (from connect till disconnect)
   private CWSPSession s;

   // holds the Method transaction for posting (from m_send_req till m_send_conf)
   private CWSPMethodManager m;

   /**
    * Constructs a WAP sender object.
    *
    * @param wapgw the wap gateway to use
    * @param wapgwport the port of the wap gateway
    */
   public NokiaSender(InetAddress wapgw, int wapgwport, String posturi,
                          byte[] dataToSend, String contentType){
      this.bytes = dataToSend;
      this.posturi = posturi;
      this.wapgw = wapgw;
      this.wapgwport = wapgwport;
      this.contentType = contentType;


      if ( bytes == null) {
	  encode();
      }

      init();
   }

   /**
    * This method connects to the wap gateway and opens a WSP session.
    */
   private void init()
   {
     try
     {
        s = new CWSPSession(wapgw, wapgwport, this);
        System.out.println("connecting to WAP gateway " + wapgw);
        s.s_connect();
     }
     catch (Exception e)
     {
        e.printStackTrace();
     }

   }

    private byte[] readFile(String file) 
    {
	byte b[] = null;
	try {
	File f = new File(file);
	long len = f.length();
	b = new byte[(int)len];
	FileInputStream fi = new FileInputStream(f);
	fi.read(b);
	} catch (Exception e) {
	    e.printStackTrace();
	}
	return b;
    }

    private void encode() 
    {
	// code to retrieve ore create the Multimedia Message
	MMMessage mm=new MMMessage();
	
	mm.setVersion(IMMConstants.MMS_VERSION_10);
	mm.setMessageType(IMMConstants.MESSAGE_TYPE_M_SEND_REQ);
	mm.setTransactionId("tid_01");
	mm.setDate(new Date(System.currentTimeMillis()));
	mm.setFrom("+4369914219503/TYPE=PLMN");
	mm.addToAddress("+4369914219500/TYPE=PLMN");
	mm.addCcAddress("+436502323555/TYPE=PLMN");
	//mm.addToAddress("+4369911111010/TYPE=PLMN");
	mm.setSubject("test mms");
	mm.setMessageClass(IMMConstants.MESSAGE_CLASS_PERSONAL);
	mm.setPriority(IMMConstants.PRIORITY_HIGH);
	mm.setContentType(IMMConstants.CT_APPLICATION_MULTIPART_MIXED);
	
	//    In case of multipart related message and a smil presentation available
	//    mm.setContentType(IMMConstants.CT_APPLICATION_MULTIPART_RELATED);
	//    mm.setMultipartRelatedType(IMMConstants.CT_APPLICATION_SMIL);
	//    mm.setPresentationId("<A0>"); // where <A0> is the id of the content containing the SMIL presentation
	
	MMContent part1=new MMContent();
	// read the file with readFile() that is a function that reads a file and
	// returns an array of bytes
	byte [] buf1 = readFile("text.txt");
	part1.setContent(buf1,0,buf1.length);
	part1.setContentId("text.txt");
	part1.setType(IMMConstants.CT_TEXT_PLAIN);
	mm.addContent(part1);
	
	MMContent part2=new MMContent();
	byte [] buf2 = readFile("img1.jpg");
	part2.setContent(buf2,0,buf2.length);
	part2.setContentId("img1.jpg");
	part2.setType(IMMConstants.CT_IMAGE_JPEG);
	mm.addContent(part2);

	// instantiate an encoder object
	MMEncoder encoder=new MMEncoder();
	
	// set the message to be encoded
	encoder.setMessage(mm);
	
	// encode the message
	try {
	    encoder.encodeMessage();
	} catch (MMEncoderException e) {
	    System.err.println("An error occurred encoding the message.");
	    e.printStackTrace();
	    System.exit(1);
	}
	
	bytes=encoder.getMessage();
	System.out.println("encoded");
    }

   /**
   * Implementation of IWSPUpperLayer.
   * Is called by the WAP stack after being connected.
   * We then send the Message in a POST.
   */
   public  void s_connect_cnf()
   {
      try
      {
         System.out.println("connected to WAP gateway " + wapgw);

         System.out.println("sending data (WSP POST)");
         m = s.s_post(bytes,
                      contentType,
                      posturi);

      }
      catch (Exception e )
      {
         e.printStackTrace();
      }
   }

   /**
    * Implementation of IWSPUpperLayer.
    * this method is called by the wap stack after a response of a method is received.
    * @param payload the payload from the response
    * @param contentType the content type of the response
    * @param moreData will there come more data belonging to this result?
    */
   public void s_methodResult_ind(byte[] payload,
                                  String contentType,
                                  boolean moreData)
   {
      // decode the response here...

      String nl = System.getProperty("line.separator");

      
      System.out.println("Response More Data: " +  moreData );
      System.out.println("Response Content Type: " +  contentType );

     
      saveToFile(contentType + "_" + System.currentTimeMillis() +".pdu", payload); 
    
      if (!moreData) {
	  System.out.println("disconnecting from WAP gateway " + wapgw);
	  m.s_methodResult(null);
	  s.s_disconnect();

	  MMSPDU pdu = new MMSPDU();
	  
	  pdu.setPayload(payload);
      }
   }

   /**
    * Implementation of IWSPUpperLayer. NOT USED.
    * @param reason
    */
   public  void s_suspend_ind(short reason){}

   /**
    * Implementation of IWSPUpperLayer. NOT USED.
    */
   public  void s_resume_cnf(){}

   /**
    * Implementation of IWSPUpperLayer.
    * Called by the WAP stack if we are disconnected.
    * @param reason the reason, why we are disconnected
    */
   public  void s_disconnect_ind(short reason)
   {
      System.out.println("disconnected from WAP gateway " + wapgw);
   }

   /**
    * Implementation of IWSPUpperLayer. NOT USED.
    * if we receive a redirect from the server.
    * @param redirectInfo
    */
   public  void s_disconnect_ind(Vector redirectInfo){
     System.out.println("disconnecting from WAP gateway " + wapgw);
     this.m.s_methodResult(null);
     s.s_disconnect();
   }

   public void s_disconnect_ind(InetAddress[] redirectInfo){
     System.out.println("---redirected to " + redirectInfo.toString());
   }




  private void saveToFile(String filename, byte[]b) {
    try{
      FileOutputStream fo;
      fo = new FileOutputStream(filename);
      fo.write(b);
      fo.close();
    } catch (Exception e){
      // Host address not ok
      e.printStackTrace();
      System.exit(1);
    }
  }


   /**
    * It automatically connects to the WAP gateway.
    * After the connect.conf it sends the WAP POST.
    * After all it disconnects from the gateway.
    *
    * @param args none (ignored)
    */
    public static void main(String[] args)
    {
	try {
	    InetAddress gateway = InetAddress.getByName("194.24.131.17");

	    NokiaSender poster = 
		new NokiaSender(
			   gateway, 
			   9201, 
			   "http://mmsc.one.at/mms/wapenc",
			   null,
			   "application/vnd.wap.mms-message");
	}
	catch (Exception ex) {
	    ex.printStackTrace();
	}
   }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩激情一区二区三区| 国产欧美一区视频| 久久久久久亚洲综合影院红桃| 中文字幕av免费专区久久| 亚洲日本一区二区| 伦理电影国产精品| 欧美中文字幕一二三区视频| 久久久久久一二三区| 婷婷夜色潮精品综合在线| 成人精品视频网站| 精品国产1区2区3区| 亚洲色大成网站www久久九九| 免费不卡在线视频| 欧洲一区二区三区在线| 中文字幕在线观看一区二区| 激情另类小说区图片区视频区| 91黄视频在线| 亚洲特黄一级片| 国产成人免费在线视频| 久久先锋资源网| 麻豆成人91精品二区三区| 91福利区一区二区三区| 国产精品高潮呻吟| 黑人巨大精品欧美黑白配亚洲| 欧美色偷偷大香| 国产精品黄色在线观看| 国产乱码精品一品二品| 久久你懂得1024| 国内精品久久久久影院薰衣草| 欧美精品在线观看播放| 性感美女久久精品| 欧美视频在线一区| 亚洲综合视频网| 色吧成人激情小说| 亚洲视频一区二区免费在线观看 | 欧美一区二区三区四区高清| 一区二区三区欧美| 91高清视频免费看| 亚洲尤物视频在线| 69av一区二区三区| 日韩电影免费在线观看网站| 欧美片在线播放| 日本视频在线一区| 欧美大片日本大片免费观看| 久草在线在线精品观看| 精品国产一区二区三区不卡| 国产老妇另类xxxxx| 国产日韩欧美麻豆| 99re热这里只有精品免费视频| ●精品国产综合乱码久久久久| 一本到一区二区三区| 午夜视频在线观看一区二区 | 欧美伊人久久久久久久久影院| 亚洲综合一区二区精品导航| 制服丝袜在线91| 激情文学综合插| 国产精品毛片久久久久久久| 91国产免费观看| 久久精品国产精品青草| 欧美国产成人精品| 在线免费观看日韩欧美| 蜜桃精品视频在线| 国产精品乱码妇女bbbb| 欧美日韩国产a| 韩国v欧美v日本v亚洲v| 亚洲欧美综合另类在线卡通| 欧美日韩国产天堂| 国产精品一级二级三级| 亚洲精品五月天| 精品三级在线观看| 色噜噜久久综合| 久久成人综合网| 色猫猫国产区一区二在线视频| 久久日韩精品一区二区五区| www.成人在线| 亚洲综合在线五月| 成人短视频下载| 精品国产乱码久久久久久牛牛| 一区二区三区欧美日韩| 亚洲精品在线电影| 91麻豆国产精品久久| 久久不见久久见免费视频7| 欧美国产乱子伦| 91精品国产一区二区三区蜜臀| 成人网男人的天堂| 日本中文在线一区| 综合久久给合久久狠狠狠97色 | 偷拍一区二区三区| 国产精品视频麻豆| 欧美一区二区视频观看视频| 97精品超碰一区二区三区| 久久成人麻豆午夜电影| 亚洲aaa精品| 色综合久久综合| 韩日av一区二区| 亚洲精品自拍动漫在线| 久久精品免费在线观看| 日韩午夜在线影院| 精品视频一区 二区 三区| 一本大道久久a久久精品综合| 久久66热re国产| 日韩高清不卡在线| 亚洲电影一级黄| 日韩理论片在线| 国产日产欧美一区| 精品99久久久久久| 69精品人人人人| 精品视频全国免费看| 欧美午夜影院一区| 91久久精品日日躁夜夜躁欧美| 波多野结衣亚洲| 成人午夜电影久久影院| 精品一区二区三区视频在线观看| 日本伊人色综合网| 日韩电影在线一区| 另类的小说在线视频另类成人小视频在线 | 日韩欧美成人一区二区| 欧美精品久久99| 欧美精品久久天天躁| 欧美精品xxxxbbbb| 欧美日韩精品福利| 欧美剧情片在线观看| 91黄色激情网站| 欧美午夜精品电影| 欧美人动与zoxxxx乱| 91麻豆精品国产91久久久久久 | 亚洲乱码一区二区三区在线观看| 18成人在线观看| 亚洲一区二区在线免费观看视频| 一区二区三区在线播放| 亚洲不卡在线观看| 视频一区二区三区在线| 美女看a上一区| 国产精品一二三四五| 成人丝袜18视频在线观看| 99久久精品久久久久久清纯| 色悠久久久久综合欧美99| 在线观看欧美精品| 欧美一区二区视频在线观看| 欧美精品一区二区久久久| 国产精品女主播在线观看| 亚洲精品成a人| 蜜臀久久久久久久| 国产精品系列在线播放| av成人免费在线观看| 欧美日韩第一区日日骚| 日韩欧美国产午夜精品| 国产精品午夜免费| 亚洲国产综合91精品麻豆| 久久99国产精品免费| 成人h动漫精品| 欧美一区二区成人| 国产精品久久久久aaaa樱花| 一区二区三区精品在线| 人人精品人人爱| 成人免费va视频| 正在播放一区二区| 自拍偷拍欧美精品| 免费高清在线一区| 色哟哟在线观看一区二区三区| 欧美久久一二区| 中文字幕欧美区| 麻豆一区二区三| 99vv1com这只有精品| 精品美女在线观看| 亚洲精品v日韩精品| 国产91综合一区在线观看| 欧美日韩情趣电影| 中文字幕在线播放不卡一区| 美女网站色91| 欧美日韩另类国产亚洲欧美一级| 久久久国际精品| 美国一区二区三区在线播放| 欧美综合一区二区三区| 国产三级精品三级| 蜜桃精品在线观看| 欧美人伦禁忌dvd放荡欲情| 国产精品的网站| 国产精品1区2区| 精品少妇一区二区三区| 丝袜国产日韩另类美女| 一本一道波多野结衣一区二区| 国产欧美一区二区三区网站| 美女www一区二区| 欧美日韩精品系列| 亚洲综合在线视频| 色视频成人在线观看免| 亚洲日本va午夜在线电影| 国产69精品久久久久毛片| 日韩精品一区二| 美女网站色91| 日韩欧美在线123| 亚洲成人精品影院| 在线欧美一区二区| 亚洲最大的成人av| 欧美性感一类影片在线播放| 亚洲一区二区三区四区在线观看| 99re热这里只有精品免费视频| 国产精品视频一二三区| 成人一区二区三区在线观看|