⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xboxapit.java

📁 中国联通 gip协议代码,应该会有用的
💻 JAVA
字号:
package com.twinbays.etot.t ;

import com.twinbays.etot.* ;
import java.io.* ;

public class XboxAPIT
{
	public static void main( String args[] )
	{
		if( args == null || args.length == 0 )
		{
			System.out.println( "what do you want?send,sendBatch or recv" ) ;
			return ;
		}
		if( (args[0]).equals( "send" ) )
		{
			java.util.Date oBegin = new java.util.Date() ; 
			for( int i=0; i<3; i++ )
			{
				try
				{
					String strContent = new String( ("这是双湾ETOT发的测试短信.").getBytes(), "GBK" ) ;
					byte[] abContent = strContent.getBytes( "GBK" ) ;
					XboxAPI xApi = new XboxAPI() ;
					int nOid = xApi.sendSMS( "13066989863", "ETOTTEST", 25, 
								abContent, (byte)0, (byte)0, "20020519224912", (short)1440, (short)1, (short)1440, "0" ) ;
					System.out.println( "" + i + ":" + nOid ) ;
				}				
				catch( ApiInitException ae )
				{
					System.out.println( "" + i + ":" + ae ) ;
				}
				catch( java.io.UnsupportedEncodingException ae )
				{
					System.out.println( "" + i + ":" + ae ) ;
				}
			}
			java.util.Date oEnd = new java.util.Date() ; 
			System.out.print( "time:" ) ;
			System.out.println( oEnd.getTime() - oBegin.getTime() ) ;
		}
		else if( (args[0]).equals( "sendBatch" ) )
		{
			try
			{
				String strContent = new String( "这是双湾ETOT发的测试短信.".getBytes(), "GBK" ) ;
				byte[] abContent = strContent.getBytes( "GBK" ) ;
				XboxAPI xApi = new XboxAPI() ;
				int[] anOid = xApi.sendBatchSMS(  "13066989863,1306698913066989863", "ETOTTEST", 24, 
								abContent, "20020519224912", (short)1440, (short)1, (short)5, "13066989863" ) ;
				System.out.println( "total:" + anOid.length ) ;
				for( int i=0; i<anOid.length; i++ )
					System.out.println( "" + i + ":" + anOid[i] ) ;
			}
			catch( ApiInitException ae )
			{
				System.out.println( ae ) ;
			}
			catch( java.io.UnsupportedEncodingException e )
            {
                 System.out.println( e ) ;
            }
		}
		else if( (args[0]).equals( "recv" ) )
		{
			try
			{
				XboxAPI xApi = new XboxAPI() ;
				Receive[] aRec = xApi.recvMsg( (byte)10 ) ;
				if( aRec != null )
				{
					for( int i=0; i<aRec.length; i++ )
						System.out.println( aRec[i].toString() ) ;
				}
			}
			catch( ApiInitException ae )
			{
				System.out.println( ae ) ;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -