Determing client's IP

?

AuthorDeterming client's IP
Анатоли&

23.04.2009 18:39:46
Registered user
How to determine client's IP address in THTTPServer.OnClientConnected, THTTPServer.OnClientDisonnected and TRtcFunction.OnExecute events?
Danijel Tkalcec [RTC]

23.04.2009 19:45:05
Registered user
You get the "Sender:TRtcConnection" parameter in every event, which has the?PeerAddr property?(contains clients IP address).

There is even more information about the client available through the "Sender" parameter (which you get in every event triggered on the Server), you just need to typecast the variable to "TRtcDataServer" (as shown in Quick Start examples). For a complete list of methods and properties available through the "Sender" parameter received in every event on the RTC Server, check the following Help topics:

TRtcConnection?(master class)
TRtcServer?(extends TRtcConnection)
TRtcDataServer?(extends TRtcServer)

TRtcHttpServer, TRtcISAPIServer and TRtcMessageServer components all extend TRtcDataServer.

Best Regards,
Danijel Tkalec
Анатоли&

23.04.2009 20:55:24
Registered user
A little bit strange behavior...

I have checked this property before ask you :-) But only in THTTPServer.OnClientConnected event. And it's always return '0.0.0.0' (when client works on localhost and when client works in network).

But inside TRtcFunction.OnExecute event handler property PeerAddr returns valid IP address.
Danijel Tkalcec [RTC]

23.04.2009 22:42:27
Registered user
Sorry, I've missed to mention one important fact.?

You should use the "OnConnect" and "OnDisconnect" events instead of the "OnClientConnect" and "OnClientDisconnect" events to monitor successful connections. The "OnClientConnect", "OnConnecting", "OnClientDisconnect" and "OnDisconnecting" events are there for notification purposes only and will not give you access to all connection parameters.

To be more precise, the RealThinClient SDK has 3 events which can be triggered in the connect process: "OnClientConnect", "OnConnecting" and "OnConnect".

The "OnClientConnect" event (which you have probably meant with "OnClientConnected") is the first event to be triggered when the Server is notified about a new client connection arriving, but *before* a connection has successfully been established and before a connection is ready for use. The same goes for the OnConnecting event.

Since the connection is not fully established yet, you will NOT have access to all connection parameters from the "OnClientConnect" and "OnConnecting" events (for example, the "PeerAddr" and "PeerPort" properties are still undefined), and there is no guarantee the connection will really be established. The OnClientConnect event could actually be immediately followed by the OnClientDisconnect event without the connection ever having been fully established.

On the other hand, the "OnConnect" event is fired only after the connection has successfully been established and when the connection is ready for use. Starting from this event onward, your Server can communicate with the Client (send and receive data). From the "OnConnect" event, you will have access to the clients IP address (through the PeerAddr property).

Also note that the OnClientConnect, OnConnecting, OnClientDisconnect and OnDisconnecting events will not necessarily be triggered by all low-level connection providers (all APIs), but the OnConnect and OnDisconnect events will.

Best Regards,
Danijel Tkalcec

轉載于:https://www.cnblogs.com/liangchua/p/6594010.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/371252.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/371252.shtml
英文地址,請注明出處:http://en.pswp.cn/news/371252.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

mysql aa復制_MySQL的復制架構與優化

MySQL的復制架構與優化###########原理###########1.主服務器將更新的數據的sql語句(例如,insert,update,delete等)寫入到二進制文件中(由log-bin選項開啟)。此二進制文件由一個索引文件跟蹤維護。2.從服務器連接(使用I/O線程連接)主服務器&a…

如何安裝Gradle

Gradle是一個簡單而強大的構建工具。 它類似于Ant構建工具。 它可以很好地管理構建,還可以處理構建依賴性。 Gradle最好的部分是它是開源項目。 如果您正在考慮安裝并嘗試一下,那么您來對地方了。 Gradle的開發周期為4周,因此,每隔…

nmap使用指南

一、目標指定 1.CIDR標志位 192.168.1.0/24 2.指定范圍 192.168.1.1-255 192.168.1-255.1&#xff08;任意位置&#xff09;3.IPv6地址只能用規范的IPv6地址或主機名指定。 CIDR 和八位字節范圍不支持IPv6&#xff0c;因為它們對于IPv6幾乎沒什么用。 -iL <文件名> 主機名…

#Pragma Pack(n)與內存分配

#pragma pack(n) 解釋一&#xff1a; 每個特定平臺上的編譯器都有自己的默認“對齊系數”(也叫對齊模數)。程序員可以通過預編譯命令#pragma pack(n)&#xff0c;n1,2,4,8,16來改變這一系數&#xff0c;其中的n就是你要指定的“對齊系數”。 規則&#xff1a; 1、數據成員對齊規…

Java死了還是無敵?

作家艾薩克阿西莫夫&#xff08;Isaac Asimov&#xff09;曾經說過“唯一不變的就是變化”。 這不僅僅是軟件行業中的一個短語&#xff0c;這是絕對的事實。 曾經有一天&#xff0c;Corba為王&#xff0c;但Web Services篡奪了它。 即使在Web服務領域&#xff0c;過去也全都是關…

mysql數據庫訪問問題嗎_#MySQL數據庫無法遠程訪問的問題

在 Ubuntu上裝了mysql&#xff0c;因為項目的數據庫是mysql&#xff0c;將項目放在tomcat里面webapp下面&#xff0c;一直啟動不成功。本來一直以為是jdbc驅動問題&#xff0c;后來發現不是。1.cd /etc/mysql 找到my.cnf查找到bind-address&#xff0c;將 bind-address127.0.0.…

SolidEdge如何復制特征 建立類似于UG 塊的概念

直接CtrlC和CtrlV可以實現特征的復制粘貼 按N鍵可以改變特征方向 已經復制完成的特征要進行定位&#xff0c;則右擊該特征&#xff0c;編輯輪廓&#xff0c;可以進行聰慧尺寸的標注 使用特征庫的方式&#xff0c;就像UG的塊一樣&#xff0c;可以給所有零件調用。在任意位置新建…

Gradle自定義插件

本教程介紹了創建Gradle獨立自定義插件的方法。 它涵蓋以下主題 創建任務&#xff0c;并在“自定義”插件中使用它 獨立的自定義插件 簡短的插件ID 使用settings.gradle自定義Gradle設置 項目信息&#xff1a; 搖籃版本&#xff1a;1.1 操作系統平臺&#xff1a;Ubuntu 1…

mysql映射文件_Mybatis SQL映射文件

簡單查詢insert添加insert可以使用數據庫支持的自動生成主鍵策略&#xff0c;設置useGeneratedKeys”true”&#xff0c;然后把keyProperty 設成對應的列&#xff0c;就搞定了。比如說上面的StudentEntity 使用auto-generated 為id 列生成主鍵.還可以使用selectKey元素。下面例…

監聽微信、支付寶等移動app及瀏覽器的返回、后退、上一頁按鈕的事件方法

在實際的應用中&#xff0c;我們常常需要實現在移動app和瀏覽器中點擊返回、后退、上一頁等按鈕實現自己的關閉頁面、調整到指定頁面或執行一些其它操作的 需求&#xff0c;那在代碼中怎樣監聽當點擊微信、支付寶、百度糯米、百度錢包等app的返回按鈕或者瀏覽器的上一頁或后退按…

第七天作業

---恢復內容開始--- 作業一&#xff1a;nginx服務 二進制安裝nginx包 作為web服務修改配置文件 讓配置生效&#xff0c;驗證配置 直至出現epel的兩個文件&#xff0c;否則reinstall, 接下來寫配置文件&#xff0c; 這款軟件的服務目錄&#xff0c; 在里面編輯一些東西&#xff…

Java測試提示

介紹 我喜歡自動化測試。 在一次極少的轉移到op-ed 1中&#xff0c;我想到了一些想法&#xff08;閱讀–意見&#xff09;。 在開始如何最好地構成您的測試之前&#xff0c;我先簡單問一下–測試的原因是什么&#xff1f; 大致來說&#xff0c;我認為它們是&#xff1a; 減少…

pdo mysql fedora_在Fedora 23 Server和Workstation上安裝LAMP(Linux, Apache, MariaDB和PHP)

在安裝LAMP之前&#xff0c;建議先更新系統包$ sudo dnf update第一步&#xff1a;安裝Apache Web服務器1.在Fedora 23安裝Apache&#xff0c;你可以運行下面的命令&#xff1a;$ sudo dnf install httpd2.安裝完成后&#xff0c;我們設置在系統啟動時自動啟動Apache&#xff0…

洛谷P1937 [USACO10MAR]倉配置Barn Allocation

題目描述 Farmer John recently opened up a new barn and is now accepting stall allocation requests from the cows since some of the stalls have a better view of the pastures. The barn comprises N (1 < N < 100,000) stalls conveniently numbered 1..N; sta…

人臉數據庫大全(包括人臉識別、關鍵點檢測、表情識別,人臉姿態等等)

搞計算機視覺的人&#xff0c;對人臉技術并不陌生。在做實驗的時候需要各種數據集進行訓練&#xff0c;卻往往苦于找不到合適的數據集&#xff0c;這篇文章將給大家帶來一點福音。 目前為止最全的是人臉數據庫總結&#xff1a; The Color FERET Database, USA The FERET progra…

JavaFX游戲(四連環)

這是我的第一個JavaFX游戲教程&#xff0c;也是我關于JavaFX面板的第一篇博客文章。 我僅用200幾行代碼就完成了這款四連環游戲&#xff0c;足以應付一個簡單的游戲。 我在這里使用GridPane面板對磁盤進行布局&#xff0c;GridPane是JavaFX布局窗格之一&#xff0c;但它與另一個…

vs使用了未初始化的局部變量怎么解決_C程序為什么要初始化?

作者:守望,Linux應用開發者,目前在公眾號【編程珠璣】 分享Linux/C/C++/數據結構與算法/工具等原創技術文章和學習資源。 前言 什么是初始化?為什么要初始化?靜態變量和局部變量的初始化又有什么區別?實際應用中應該怎么做?本文將一一回答這些問題。 什么是初始化 初始化…

maven 配置 pom.xml 打包生成:單jar包/jar包+lib目錄

http://www.jianshu.com/p/9146cec6cc60轉載于:https://www.cnblogs.com/Baronboy/p/7510942.html

zabbix安裝MySQL失敗_MySQL數據庫之zabbix3.x安裝出現“configure: error: Not found mysqlclient library”的解決辦法...

本文主要向大家介紹了MySQL數據庫之zabbix3.x安裝出現“configure: error: Not found mysqlclient library”的解決辦法 &#xff0c;通過具體的內容向大家展現&#xff0c;希望對大家學習MySQL數據庫有所幫助。如題所示&#xff0c;在CentOS6.x的系統中安裝zabbix3.x&#xff…

拼圖項目:延期的后果

Mark Reinhold先生于2012年7月宣布 &#xff0c;他們計劃從Java 8撤回Jigsaw項目 &#xff0c;因為Jigsaw計劃于2013年9月&#xff08;從現在開始一年&#xff09;推遲其發布。 這個日期是眾所周知的&#xff0c;因為Oracle已決定實施Java的兩年路線圖計劃&#xff0c;因此2013…