日期:2014-05-20  浏览次数:20586 次

如何用Java代码写程序,可以将消息发送到RTX 2006服务器的相对用户。
我这边安装了个RTX   2006服务器(腾讯通),现在要在我们的应用系统中将信息发送到已知的RTX号码的用户,以前用RTX3.6.1是可以的,不知是不是代码有问题,请指教,急呀!

public   class   RtxSend   {
    private   String   CLASSNAME   =   this.getClass().getName();
    public   RtxSend()   {
    }

    private   final   static   String   RTX_URL   =   "http://198.10.51.7:8012/ ";

    public   void   rtxSend(String   title,   String   rtxNo)   {
               
                  System.out.println( "begin ");
                  System.out.println(rtxNo);
        HttpURLConnection   httpConnection   =   null;
        try   {
            java.net.URL   url   =   null;
            try   {
                url   =   new   URL(RTX_URL   +   "sendnotify.cgi?receiver= "   +
                                            rtxNo   +   "&msg= "   +
                                            java.net.URLEncoder.encode(title));
            }
            catch   (Exception   ex)   {
                url   =   new   URL(RTX_URL   +   "sendnotify.cgi?receiver= "   +
                                            rtxNo   +   "&msg= "   +
                                            java.net.URLEncoder.encode(title)+ "&sender=6010 ");
            }
              System.out.println( "beginsend ");
            httpConnection   =   (HttpURLConnection)   url.openConnection();
            if(httpConnection!=null)
                    System.out.println( "okkkkkkkkkkkk ");
                    System.out.println(title);
            httpConnection.getHeaderField(4);   //连接上
              System.out.println( "endsend ");
            httpConnection.disconnect();
        }
        catch   (Exception   e)   {
            System.out.println(CLASSNAME+ ": "+e.getMessage());
        }
        finally   {
            if   (httpConnection   !=   null)   {