SIP:错误数据连接丢失

2024-03-31

我已经在 android 中使用本机 sip 创建了 sip 应用程序。在其中,我在从 sip 服务器取消注册帐户时遇到问题,每次我得到数据连接丢失我也在android文档中看到,但没有对此错误的简短解释。而且它在注册时面临各种错误,如in_progress、transaction_termminate等,这些错误在doc中没有适当的解释。 这是我的代码:

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.*;
import android.widget.Chronometer;
import android.net.sip.*;
import java.text.ParseException;
import commonUtilities.Prefs;

public class WalkieTalkieActivity extends Activity implements View.OnTouchListener {

    public String sipAddress = null;
    public SipManager manager = null;
    public SipProfile me = null;
    public SipAudioCall call = null;
    public SipErrorCode sipcode;
    public SipException sipexeception;
    public static WalkieTalkieActivity walkiy;

    public static WalkieTalkieActivity getInstance(Context c) {
        if (walkiy == null) {
            walkiy = new WalkieTalkieActivity();
        }
        return walkiy;
    }@
    Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        // "Push to talk" can be a serious pain when the screen keeps turning off.
        // Let's prevent that.
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        Log.e("onCreate", "onCreate");
        initializeManager(this);
    }@
    Override
    public void onStart() {
        super.onStart();
        // When we get back from the preference setting Activity, assume
        // settings have changed, and re-login with new auth info.
        initializeManager(this);
    }@
    Override
    public void onDestroy() {

        super.onDestroy();
        if (call != null) {
            call.close();
        }
        closeLocalProfile();
    }@
    Override
    protected void onResume() {
        // TODO Auto-generated method stub
        initializeManager(this);
        super.onResume();
    }
    public void initializeManager(Context ctx) {


        if (manager == null) {
            Log.e("initialising ", "ini manager");
            manager = SipManager.newInstance(ctx);
        }
        initializeLocalProfile(ctx);
    }

    public void initializeLocalProfile(final Context ctx) {
        if (manager == null) {
            updateStatus("Not Supporting.", ctx);
            Log.e("return", "manager is null ");
            return;
        }

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
        String username = prefs.getString("namePref", Prefs.getUserName(ctx));
        String domain = prefs.getString("domainPref", "255.235.472");
        String password = prefs.getString("passPref", Prefs.getUserPassword(ctx));

        if (username.length() == 0 || domain.length() == 0 || password.length() == 0) {
            return;
        }
        try {
            SipProfile.Builder builder = new SipProfile.Builder(username, domain);
            builder.setPassword(password);
            me = builder.build();
            Intent intent = new Intent();
            intent.setAction("android.SipDemo.INCOMING_CALL");
            PendingIntent pendingIntent = PendingIntent.getBroadcast(ctx, 0, intent, Intent.FILL_IN_DATA);
            manager.open(me, pendingIntent, null);

            if (!manager.isRegistered(me.getUriString())) {
                manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {

                    public void onRegistering(String localProfileUri) {
                        Log.e("Sip restration", "Registering with SIP Server...");
                        updateStatus("Registering with SIP Server...", ctx);
                    }

                    public void onRegistrationDone(String localProfileUri, long expiryTime) {
                        Log.e("Sip restration", "Ready");
                        updateStatus("Ready", ctx);
                    }

                    public void onRegistrationFailed(String localProfileUri, int errorCode,
                        String errorMessage) {
                        Log.e("Registration Error Code ", SipErrorCode.toString(errorCode) + errorCode);
                        updateStatus(errorCode + " " + SipErrorCode.toString(errorCode), ctx);
                    }
                });
            } else {
                Log.e("already register", "already register");
                updateStatus("Ready", ctx);
            }
        } catch (ParseException pe) {
            updateStatus("Connection Error.", ctx);
        } catch (SipException se) {
            updateStatus("Connection error.", ctx);
        }
    }

    public Boolean closeLocalProfile() {
        Log.e("Closing profile", "closing profile " + me.getUriString());

        if (manager == null) {
            return false;
        }
        try {
            if (me != null) {
                Log.e("Unregistering profile", "Un registering profile ");
                manager.unregister(me, null);
                manager.close(me.getUriString());
            }
        } catch (Exception ee) {
            Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
        }
        return false;
    }
    public void initiateCall(String number, final Context ctx, final View v) {

        //      updateStatus(sipAddress);
        Log.d("Number", "" + number);
        sipAddress = number;
        Log.e("initiating call", "initiating call");
        try {
            SipAudioCall.Listener listener = new SipAudioCall.Listener() {@
                Override
                public void onCallBusy(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("buzy", "buzy");
                    super.onCallBusy(call);
                }@
                Override
                public void onCallHeld(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("held", "held");
                    super.onCallHeld(call);
                }@
                Override
                public void onCalling(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("calling", "calling");
                    super.onCalling(call);
                }@
                Override
                public void onChanged(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("changed", "changed");
                    super.onChanged(call);
                }@
                Override
                public void onError(SipAudioCall call, int errorCode,
                    String errorMessage) {
                    // TODO Auto-generated method stub
                    Log.e("call error", "error" + SipErrorCode.toString(errorCode));
                    CallingScreen.fa.finish();
                    super.onError(call, errorCode, errorMessage);

                }@
                Override
                public void onReadyToCall(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("ready to call", "ready to call ");
                    super.onReadyToCall(call);
                }@
                Override
                public void onRinging(SipAudioCall call, SipProfile caller) {
                    // TODO Auto-generated method stub
                    Log.e("ringing", "ringing");

                    super.onRinging(call, caller);
                }@
                Override
                public void onRingingBack(SipAudioCall call) {
                    // TODO Auto-generated method stub
                    Log.e("ringing back", "ringing back");
                    super.onRingingBack(call);
                }@
                Override
                public void onCallEstablished(SipAudioCall call) {
                    Log.e("call established", "call established");
                    call.startAudio();
                    updateTime(true, ctx);
                }@
                Override
                public void onCallEnded(SipAudioCall call) {
                    Log.e("call ended", "call ended");

                    updateTime(false, ctx);
                    CallingScreen.fa.finish();
                }
            };
            Log.e("param 1 ", "" + me.getUriString());
            call = manager.makeAudioCall(me.getUriString(), sipAddress + "@216.245.200.2:5060", listener, 30);
        } catch (Exception e) {
            e.printStackTrace();
            Log.i("WalkieTalkieActivity/InitiateCall", "Error when trying to close manager.", e);
            if (me != null) {
                try {
                    closeLocalProfile();
                } catch (Exception ee) {
                    ee.printStackTrace();
                    Log.i("WalkieTalkieActivity/InitiateCall",
                        "Error when trying to close manager.", ee);
                    ee.printStackTrace();
                }
            }
            if (call != null) {
                call.close();
            }
        }
    }
    public void updateStatus(final String status, final Context context) {
        // Be a good citizen.  Make sure UI changes fire on the UI thread.
        this.runOnUiThread(new Runnable() {
            public void run() {
                generateNotification(context, status);
            }
        });
    }
    public void updateTime(final Boolean status, final Context context) {
        // Be a good citizen.  Make sure UI changes fire on the UI thread.
        this.runOnUiThread(new Runnable() {
            public void run() {
                if (status) {
                    CallingScreen.fa.ch = (Chronometer) CallingScreen.fa.findViewById(R.id.time);
                    CallingScreen.fa.ch.setTypeface(CallingScreen.normal);
                    CallingScreen.fa.calling_screen_text.setVisibility(View.GONE);

                    CallingScreen.fa.ch.setVisibility(View.VISIBLE);
                    CallingScreen.fa.ch.start();
                } else {
                    CallingScreen.fa.ch.stop();
                }
            }
        });
    }

    public void updateStatus(SipAudioCall call) {
        String useName = call.getPeerProfile().getDisplayName();
        if (useName == null) {
            useName = call.getPeerProfile().getUserName();
        }
        //      updateStatus(useName + "@" + call.getPeerProfile().getSipDomain());
    }
    public boolean onTouch(View v, MotionEvent event) {
        if (call == null) {
            return false;
        } else if (event.getAction() == MotionEvent.ACTION_DOWN && call != null && call.isMuted()) {
            call.toggleMute();
        } else if (event.getAction() == MotionEvent.ACTION_UP && !call.isMuted()) {
            call.toggleMute();
        }
        return false;
    }
    public void endcall() {
        if (call != null) {
            try {
                call.endCall();
            } catch (SipException se) {
                Log.d("WalkieTalkieActivity/onOptionsItemSelected",
                    "Error ending call.", se);
            }
            call.close();
        }
    }
    public void speaker(Boolean speak) {
        if (call != null)
            call.setSpeakerMode(speak);
    }
    public static void generateNotification(Context context, String message) {
        int icon = R.drawable.ic_launcher;
        long when = System.currentTimeMillis();
        NotificationManager notificationManager = (NotificationManager)
        context.getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new Notification(icon, message, when);
        String title = context.getString(R.string.app_name);
        Intent notificationIntent = new Intent(context, Splash_screen.class);
        // set intent so it does not start a new activity
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
            Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent intent =
            PendingIntent.getActivity(context, 0, notificationIntent, 0);
        notification.setLatestEventInfo(context, title, message, intent);
        notificationManager.notify(0, notification);
    }
    public Boolean isRegistered() {
        if (manager != null && me != null)
            try {
                return manager.isRegistered(me.getUriString());
            } catch (SipException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();

            }
        return false;
    }

}

LOGCAT1

12 - 23 14: 19: 10.930: E / Unregistering profile(32139): Un registering profile
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): Failed to close local profile.
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): android.net.sip.SipException: SipService.createSession() returns null
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.net.sip.SipManager.unregister(SipManager.java: 507)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.phone91.android.WalkieTalkieActivity.closeLocalProfile(WalkieTalkieActivity.java: 144)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.phone91.android.DialerActivity$1$2.onClick(DialerActivity.java: 79)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java: 174)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.os.Handler.dispatchMessage(Handler.java: 99)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.os.Looper.loop(Looper.java: 155)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at android.app.ActivityThread.main(ActivityThread.java: 5520)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at java.lang.reflect.Method.invokeNative(Native Method)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at java.lang.reflect.Method.invoke(Method.java: 511)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 1029)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 796)
12 - 23 14: 19: 10.990: D / WalkieTalkieActivity / onDestroy(32139): at dalvik.system.NativeStart.main(Native Method)

日志 CAT2:

12-23 14:53:28.890: E/Unregistering profile(2001): Un registering profile 
12-23 14:53:30.050: E/Registration Error Code(2001): DATA_CONNECTION_LOST-10

我一直在检查 SipDemo 示例代码,我假设您将其用作应用程序的参考,但在注册过程中也遇到了此错误。

在检查了 Android 的源代码(4.1)后,我发现这是堆栈实现中的一个错误。更详细:

  1. SIP服务注册和Intend监听器用于更新连接信息。
  2. 当您尝试过快地注册 SipRegistrationListener 时(通过使用setRegistrationListener),由于网络信息尚未更新(未收到意图),因此返回SipErrorCode.DATA_CONNECTION_LOST,但是,实际上,会话终于正确注册了。

在你的情况下,正如你所提供的SipRegistrationListener in unregister方法,此过程失败。一个丑陋的解决方法是等待一段时间才能收到意图,或者不提供侦听器。

您还会看到,如果您替换unregister打电话经过setRegistrationLister您仍然会收到相同的错误,因此,您还可以尝试创建一个高层管理人员,这是在onRegistrationDone回调,您可以设置一个标志来了解是否可以关闭配置文件。就像是:

public void updateStatus(final int status, final Context context) {
    if(status == STATUS_OK)
        registered = true;

    // Be a good citizen.  Make sure UI changes fire on the UI thread.
    this.runOnUiThread(new Runnable() {
        public void run() {
            generateNotification(context, statusToString(status));
        }
    });
}

并且,当关闭本地配置文件时:

public Boolean closeLocalProfile() {
    Log.e("Closing profile", "closing profile " + me.getUriString());

    if (manager == null || !registered) {
        return false;
    }
    try {
        if (me != null) {
            Log.e("Unregistering profile", "Un registering profile ");
            manager.unregister(me, null);
            manager.close(me.getUriString());
        }
    } catch (Exception ee) {
        Log.d("WalkieTalkieActivity/onDestroy", "Failed to close local profile.", ee);
    }
    return false;
}

请注意,我在中使用了一个整数updateStatus而不是字符串并使用辅助函数,statusToString将状态代码转换为字符串。

正如您可能注意到的,这将添加一个额外的管理层,该管理层最初应该已经在堆栈中,但事实并非如此。我不太确定这会修复所有返回错误(在检查源代码后我看到了几个可能的错误),但应该有所帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SIP:错误数据连接丢失 的相关文章

  • 如何快速自动发送FCM或APNS消息?

    我正在开发一项后端服务 通过 FCM 或 APNS 向移动应用程序发送推送通知 我想创建一个可以在一分钟内运行的自动化测试 并验证服务器是否可以成功发送通知 请注意 我不一定需要检查通知是否已送达 只需检查 FCM 或 APNS 是否已成功
  • 类型容器“Android 依赖项”引用不存在的库 android-support-v7-appcompat/bin/android-support-v7-appcompat.jar

    我在尝试在我的项目中使用 Action Bar Compat 支持库时遇到了某种错误 我不知道出了什么问题 因为我已按照此链接中的说明进行操作 gt http developer android com tools support libr
  • React Native 从 JavaScript 代码内部访问 strings.xml

    有没有办法访问当前值android app src main res values strings xml从 JavaScript 代码内部 我想为每个构建放置不同的端点 URL 但我什至无法检测到反应本机代码内的构建类型 而不必求助于 D
  • 如何重试已消耗的 Observable?

    我正在尝试重新执行失败的已定义可观察对象 一起使用 Retrofit2 和 RxJava2 我想在单击按钮时重试特定请求及其订阅和行为 那可能吗 service excecuteLoginService url tokenModel Ret
  • android中向sqlite中插入大量数据

    目前 我必须一次向我的 Android 中插入超过 100 亿条数据 然而 内存不足的问题会使程序崩溃 sqlite 插入测试非常简单 只需使用 for 循环生成 sql 插入命令并通过 开始 和 提交 进行包装 private Array
  • android xamarin 中的 reCaptcha

    我想在 Xamarin android 应用程序中实现验证码 我抓住了这个在 Android 中集成 googles reCaptcha 验证 https www c sharpcorner com article how to integ
  • Android Activity 生命周期函数基础知识

    我正在测试这段代码 它显示活动所处的状态 public class Activity101Activity extends Activity String tag Lifecycle Called when the activity is
  • 当文本输入聚焦在 React Native for Android 的底部工作表上时,视图移出屏幕

    我正在使用图书馆 https github com osdnk react native reanimated bottom sheet https github com osdnk react native reanimated bott
  • Android 模拟器插件无法初始化后端 EGL 显示

    我在 Cloudbees 上设置了 Jenkins 作业 并且可以在那里成功签出并编译我的 Android 项目 现在我想在 android 模拟器中运行一些 JUnit 测试并添加 Android 模拟器插件 我将 显示模拟器窗口 选项设
  • Android SIP 来电使用带有广播接收器的服务

    大家好 其实我正在尝试创建一个应用程序 支持基于 SIP 通过互联网进行音频呼叫 这里使用本机 sip 我遇到了来电问题 我已经完成了服务的注册部分 但是在接听电话时我无法接听电话 请帮助我 Service file package exa
  • 是否有 ADB 命令来检查媒体是否正在播放

    我想使用 ADB 命令检查根植于终端的外部设备中是否正在播放音频 视频 我无法找到任何 ADB 命令 如果有 我尝试过 adb shell dumpsys media player 我想要一个命令来指定视频是否正在运行 您可以使用以下命令查
  • 获取当前 android.intent.category.LAUNCHER 活动的实例

    我创建了一个库项目 并在多个应用程序之间共享 我实现了一个简单的会话过期功能 该功能将在一段时间后将用户踢回到登录屏幕 登录屏幕活动是我的主要活动 因此在清单中它看起来像这样
  • 如何使用 IF 检查 TextView 可见性

    我有一个 onCheckedChangeListener 来根据选择的单选按钮显示文本视图 我有 1 个疑问和 1 个难题 想知道是否有人可以帮助我 问题 您能否将单选组默认检查值设置为 否 单选按钮 以便一开始就不会检查任何内容 问题 如
  • Google 云端硬盘身份验证异常 - 需要许可吗? (v2)

    我一直在尝试将 Google Drive v2 添加到我的 Android 应用程序中 但无法获得授权 我收到 UserRecoverableAuthIOException 并显示消息 NeedPermission 我感觉 Google A
  • 如何发布Android .aar源以使Android Studio自动找到它们?

    我正在将库发布到内部 Sonatype Nexus 存储库 Android Studio 有一个功能 可以自动查找通过 gradle 引用的库的正确源 我将 aar 的源代码作为单独的 jar 发布到 Nexus 但 Android Stu
  • 如何使用InputConnectionWrapper?

    我有一个EditText 现在我想获取用户对此所做的所有更改EditText并在手动将它们插入之前使用它们EditText 我不希望用户直接更改中的文本EditText 这只能由我的代码完成 例如通过使用replace or setText
  • 如何默认在 ActionOpenDocument 意图中显示“内部存储”选项

    我需要用户选择一个自定义文件类型的文件 并将其从 Windows 文件资源管理器拖到 Android 设备上 但默认情况下内部存储选项不可用 当我使用以下命令启动意图时 var libraryIntent new Intent Intent
  • Android 中麦克风的后台访问

    是否可以通过 Android 手机上的后台应用程序 服务 持续监控麦克风 我想做的一些想法 不断聆听背景中的声音信号 收到 有趣的 音频信号后 执行一些网络操作 如果前台应用程序需要的话 后台应用程序必须能够智能地放弃对麦克风的访问 除非可
  • 如何确定对手机号码的呼叫是本地呼叫还是 STD 或 ISD

    我正在为 Android 开发某种应用程序 但不知道如何获取被叫号码是本地或 STD 的号码的数据 即手机号码检查器等应用程序从哪里获取数据 注意 我说的是手机号码 而不是固定电话 固定电话号码 你得到的数字是字符串类型 因此 您可以获取号
  • 一次显示两条Toast消息?

    我希望在一个位置显示一条 Toast 消息 并在另一位置同时显示另一条 Toast 消息 多个 Toast 消息似乎总是按顺序排队和显示 是否可以同时显示两条消息 是否有一种解决方法至少可以提供这种外观并且不涉及扰乱活动布局 Edit 看来

随机推荐

  • 如何通过 Java SDK 使用 AWS 端口转发会话

    我正在使用开始一个会话AWSSimpleSystemsManagementAsync如下 Map
  • VS2008 声明数组时出现预期常量表达式错误,但在 GCC 中此代码没有错误

    我有以下功能 void someFun int ar const int size int newAr size do something 我在这一行得到三个错误 Error 1 error C2057 expected constant
  • 调用 .disconnect() 后如何重新连接

    问题 发布手册后如何重新连接客户端到服务器 disconnect 在我当前的项目中 当用户从会话注销时 我需要断开客户端与服务器的连接 我做了一个socket disconnect 才能成功断开连接 服务器从会话中删除了用户 一段时间后 用
  • 如何开始使用 Selenium 2?

    我到处读到我们should现在使用 Selenium 2 如果我的理解正确的话 WebDriver 我不是在谈论 Selenium IDE 它确实很容易使用 我已经阅读了 Selenium 网站上的文档 该文档声称不完整 因为 Seleni
  • Visual Studio 扩展未知错误 - 无法推送或获取任何内容

    当我尝试通过 Visual Studio 的 Git 扩展将任何内容推送到我的 bitbucket 存储库时出现错误 Error encountered while pushing branch to the remote reposito
  • QTableView 中的搜索/查找功能

    我有一个 QWidget 里面有一个 QTableView 我需要在表格的第一列上有查找功能 因此当我单击 Ctrl F 时 会弹出一个查找对话框 class Widget QWidget def init self md parent N
  • 如何在c中增加数组

    我试图使用变量作为增量来增加 int 数组 但它会引发错误 int array MAXSIZE int n fill the array with some numbers some other code 这里的情况是 一旦我分析了前 n
  • Javascript:了解原型链

    我创建了一个简单的类 如下所示 var Class function Class prototype testObj a 2 b 3 现在如果我这样做console log Class testObj I get undefined 但是如
  • 为什么这个 c# 代码片段是合法的?

    愚蠢的问题 但是为什么下面的行会编译 int i new int 1 正如您所看到的 我没有输入第二个元素并在那里留下了逗号 即使您希望它不会编译 仍然可以编译 我想是因为 ECMA 334 标准说 array initializer va
  • 简单的 jQuery 回调在 IE 中中断

    我有几个这样的功能 this find subnav fadeIn 200 buttonHide Now 按钮隐藏 在本例中 是我在其他地方声明的函数 一旦 200ms fadeIn 完成 我想调用该函数 伟大的 适用于 FF 和 Safa
  • 带有平滑流格式 SDK 的基于 IIS 的 HLS

    我正在尝试通过 IIS 运行 HLS 并且通过 Silverlight 进行平滑流处理工作正常 但 HLS 不行 我拥有的 新的实时平滑流媒体发布点启用了 HLS 支持 通过 Smooth Streaming Format SDK 连接 P
  • 如何将 microsoft graph 365 用户个人资料照片从二进制数据转换为可读图像格式

    我已在 PHP 中使用 Microsoft Graph API 成功显示了有关管理员用户配置文件照片的信息 下面是我使用的代码
  • 向量(插入然后排序)或集合哪种方法更快?

    我有数字序列 未排序 无重复 目标是对它们进行排序 方法一 插入向量 O n 使用排序算法并排序 O nlogn 方法2 插入集合 o nlogn 哪种方法会更快 我觉得设置会更快 因为向量中的每个插入都必须分配 完整的数组元素并复制它然后
  • 通过从客户区的一部分拖动无框窗口来移动它

    正如标题所示 我想仅当用户将窗口从客户区域的一部分拖动时才移动窗口 这将是对正常标题栏移动的模仿 这是因为我的表单是自定义的 并且没有任何标题或标题栏 目前 我使用的代码如下 case WM NCHITTEST return HTCAPTI
  • 你能用 Java 获得基本的 GC 统计数据吗?

    我想让一些长时间运行的服务器应用程序定期输出 Java 中的一般 GC 性能数据 例如 Runtime freeMemory 的 GC 等价物 例如完成的周期数 平均时间等 我们的系统在客户机器上运行 怀疑配置错误的内存池导致了过多的 GC
  • 仅旋转特定 Excel 行中的文本

    我想使用以下命令旋转 Excel 文件中的标题Microsoft Office Interop 为了实现这一目标 我使用以下代码 worksheet Range A1 worksheet UsedRange Columns Count 1
  • HTTP 标头中什么被视为空白

    我刚刚阅读了 HTTP 标准 拟议标准更准确地说 第 1 部分 并对第 3 节倒数第二段中他们认为的 空白 感到困惑 https www rfc editor org rfc rfc7230 section 3 https www rfc
  • 在 Visual Studio 2008 for .NET CF 中处理不同分辨率

    我正在开发一个基于 NET CF 的图形应用程序 我的项目涉及大量绘图图像 我们决定在不同的手机分辨率上移植该应用程序 240 X 240 480 X 640 等 我将如何在单个解决方案 项目中实现这一目标 是否需要根据决议创建不同的项目
  • R 错误:java.lang.OutOfMemoryError:Java 堆空间

    我正在尝试将 R 连接到 Teradata 以将数据直接提取到 R 中进行分析 但是 我收到错误 Error in jcall rp I fetch stride block java lang OutOfMemoryError Java
  • SIP:错误数据连接丢失

    我已经在 android 中使用本机 sip 创建了 sip 应用程序 在其中 我在从 sip 服务器取消注册帐户时遇到问题 每次我得到数据连接丢失我也在android文档中看到 但没有对此错误的简短解释 而且它在注册时面临各种错误 如in