How to determine IP address of client request in CORBA
Hello
does anyone know of a way to determine which peer is making the invocation of a method in CORBA?
I need to find a way to determine the IP address of the calling peer, but at the server-side and NOT by passing the IP address as an argument with a method invocation like the following method:
void foo(in string ipAddress);
The above method declaration is in the .idl file.
Thank you in advance
There's no portable way to do this and I don't know if / how it's possible with the Sun ORB (the one available in the J2SE).
It is possible with the latest versions of JacORB (www.jacorb.org) - a free LGPL Java ORB. The feature is undocumented (as yet) but if you can decompose unit test code you can see how it works in the code in this directory:
http://www.jacorb.org/cgi-bin/cvsweb/JacORB/test/regression/src/org/jacorb/test/transport/
Similar Messages
-
How to configure website address to http request
hi
How to configure website address to http request
(I want access JBOSS URL: http://localhost:8080/HIS/Login using website like www.HIS.com)
Please help me.What I'm trying to do is connect my laptops built in wifi adapter to my home network and connect my usb wifi adapter to my phones hotspot then combine the bandwidth into one stream so that my speed is faster.
-
How to list IP address from client on the Server (TCP/IP CLIENT SERVER COMMUNICATION)
Excuse me,
In this project I want to ask how to add list IP from client that connect to server.
I have edited slightly the project.
'SERVER
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Threading.Tasks
Imports System.Reflection
Public Class ServerForm
Private _Listener As TcpListener
Private _Connections As New List(Of ConnectionInfo)
Private _ConnectionMonitor As Task
Private Sub Button_Checked(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
If StartStopButton.Checked Then
StartStopButton.Text = "Stop"
StartStopButton.Image = My.Resources.StopServer
_Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
_Listener.Start()
Dim monitor As New MonitorInfo(_Listener, _Connections)
ListenForClient(monitor)
_ConnectionMonitor = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskContinuationOptions.LongRunning)
Else
StartStopButton.Text = "Start:"
StartStopButton.Image = My.Resources.StartServer
CType(_ConnectionMonitor.AsyncState, MonitorInfo).Cancel = True
_Listener.Stop()
_Listener = Nothing
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub ListenForClient(monitor As MonitorInfo)
Dim info As New ConnectionInfo(monitor)
_Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
End Sub
Private Sub DoAcceptClient(result As IAsyncResult)
Dim monitorinfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
If monitorinfo.Listener IsNot Nothing AndAlso Not monitorinfo.Cancel Then
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
monitorinfo.Connections.Add(info)
info.AcceptClient(result)
ListenForClient(monitorinfo)
info.AwaitData()
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Invoke(doUpdateConnectionCountLabel)
End If
End Sub
Private Sub DoMonitorConnections()
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Dim monitorInfo As MonitorInfo = CType(_ConnectionMonitor.AsyncState, MonitorInfo)
Me.Invoke(doAppendOutput, "Server Started")
Do
Dim lostCount As Integer = 0
For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
Dim info As ConnectionInfo = monitorInfo.Connections(index)
If info.Client.Connected Then
If info.DataQueue.Count > 0 Then
Dim messageBytes As New List(Of Byte)
While info.DataQueue.Count > 0
Dim value As Byte
If info.DataQueue.TryDequeue(value) Then
messageBytes.Add(value)
End If
End While
Me.Invoke(doAppendOutput, "Message from IP: " + System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
End If
Else
monitorInfo.Connections.Remove(info)
lostCount += 1
End If
Next
If lostCount > 0 Then
Invoke(doUpdateConnectionCountLabel)
End If
_ConnectionMonitor.Wait(1)
Loop While Not monitorInfo.Cancel
For Each info As ConnectionInfo In monitorInfo.Connections
info.Client.Close()
Next
monitorInfo.Connections.Clear()
Invoke(doUpdateConnectionCountLabel)
Me.Invoke(doAppendOutput, "Server Stoped")
End Sub
Private Sub UpdateConnectionCountLabel()
ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ClearButton_Checked(sender As Object, e As EventArgs) Handles ClearButton.CheckedChanged
If ClearButton.Checked Then
RichTextBox1.Clear()
End If
End Sub
End Class
Public Class MonitorInfo
Private _listener As TcpListener
Public ReadOnly Property Listener As TcpListener
Get
Return _listener
End Get
End Property
Private _connections As List(Of ConnectionInfo)
Public ReadOnly Property Connections As List(Of ConnectionInfo)
Get
Return _connections
End Get
End Property
Public Property Cancel As Boolean
Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
_listener = tcpListener
_connections = connectionInfoList
End Sub
End Class
Public Class ConnectionInfo
Private _monitor As MonitorInfo
Public ReadOnly Property Monitor As MonitorInfo
Get
Return _monitor
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Get
Return _DataQueue
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Public Sub New(monitor As MonitorInfo)
_monitor = monitor
_DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
End Sub
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub AcceptClient(result As IAsyncResult)
_Client = _monitor.Listener.EndAcceptTcpClient(result)
If _Client IsNot Nothing AndAlso _Client.Connected Then
_Stream = _Client.GetStream
End If
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
End Sub
Private Sub DoReadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
info._LastReadLength = info.Stream.EndRead(result)
For Index As Integer = 0 To _LastReadLength - 1
info._DataQueue.Enqueue(info._Buffer(Index))
Next
'info.SendMessage("Data Diterima " & info._LastReadLength & " Bytes")
info.SendMessage("reply form server: " & info._LastReadLength & " Bytes")
For Each otherInfo As ConnectionInfo In info.Monitor.Connections
If Not otherInfo Is info Then
otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
End If
Next
info.AwaitData()
Else
info.Client.Close()
End If
Catch ex As Exception
info._LastReadLength = -1
End Try
End Sub
Private Sub SendMessage(message As String)
If _Stream IsNot Nothing Then
Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
Stream.Write(messageData, 0, messageData.Length)
End If
End Sub
End Class
'CLIENT
Imports System.Net
Imports System.Net.Sockets
Public Class ClientForm
Private _Connection As ConnectionInfo
Private _ServerAddress As IPAddress
Private Sub ClientForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ValidateChildren()
End Sub
Private Sub ConnectButton_Checked(sender As Object, e As System.EventArgs) Handles ConnectButton.CheckedChanged
If ConnectButton.Checked Then
If _ServerAddress IsNot Nothing Then
ConnectButton.Text = "Disconnect"
ConnectButton.Image = My.Resources.StopServer
Try
_Connection = New ConnectionInfo(_ServerAddress, CInt(PortTextBox.Text), AddressOf InvokeAppendOutput)
_Connection.AwaitData()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Connecting to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End Try
Else
MessageBox.Show("Invlid IP Server", "Cannt Connect to Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ConnectButton.Checked = False
End If
Else
ConnectButton.Text = "Connect"
ConnectButton.Image = My.Resources.StartServer
If _Connection IsNot Nothing Then _Connection.Close()
_Connection = Nothing
End If
End Sub
Private Sub SendButton_Click(sender As System.Object, e As System.EventArgs) Handles SendButton.Click
If _Connection IsNot Nothing AndAlso _Connection.Client.Connected AndAlso _Connection.Stream IsNot Nothing Then
Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(InputTextBox.Text)
_Connection.Stream.Write(buffer, 0, buffer.Length)
End If
End Sub
Private Sub ServerTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles IPTextBox.Validating
_ServerAddress = Nothing
Dim remoteHost As IPHostEntry = Dns.GetHostEntry(IPTextBox.Text)
If remoteHost IsNot Nothing AndAlso remoteHost.AddressList.Length > 0 Then
For Each deltaAddress As IPAddress In remoteHost.AddressList
If deltaAddress.AddressFamily = AddressFamily.InterNetwork Then
_ServerAddress = deltaAddress
Exit For
End If
Next
End If
If _ServerAddress Is Nothing Then
MessageBox.Show("Cannot resolve Server Address", "invalid Server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
IPTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number between 1 and 65535", "invalid Port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub InvokeAppendOutput(message As String)
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Me.Invoke(doAppendOutput, message)
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
End Sub
Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
RichTextBox1.Clear()
InputTextBox.Clear()
End Sub
End Class
Public Class ConnectionInfo
Private _AppendMethod As Action(Of String)
Public ReadOnly Property AppendMethod As Action(Of String)
Get
Return _AppendMethod
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub New(address As IPAddress, port As Integer, append As Action(Of String))
_AppendMethod = append
_Client = New TcpClient
_Client.Connect(address, port)
_Stream = _Client.GetStream
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoreadData, Me)
End Sub
Public Sub Close()
If _Client IsNot Nothing Then _Client.Close()
_Client = Nothing
_Stream = Nothing
End Sub
Private Sub DoreadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info._Stream IsNot Nothing AndAlso info._Stream.CanRead Then
info._LastReadLength = info._Stream.EndRead(result)
If info._LastReadLength > 0 Then
Dim message As String = System.Text.Encoding.ASCII.GetString(info._Buffer)
info._AppendMethod(message)
End If
info.AwaitData()
End If
Catch ex As Exception
info._LastReadLength = -1
info._AppendMethod(ex.Message)
End Try
End Sub
End Class
//ScreenShot server
http://prntscr[dot]com/5t1ol3
//Screenshot client
http://prntscr[dot]com/5t1odj
source: code[dot]msdn[dot]microsoft[dot]com/windowsdesktop/Simple-Multi-User-TCPIP-43cc3b44I have a similar chat application. When the user attempts to connect, instead of sending a simple string, the client sends a serialized object(xml string) with all relevant login and session information, this includes the user's IP address. Once the server
receives said information, depending on the type of TCP broadcast (a custom enumerated type) information from one user may be passed to a single user, or distributed to many users.
If it helps, here is the TCPBroadcast object I use. But in order for your server to understand it, you kind of have to build your server and client somewhat around it.
Option Strict On
Option Explicit On
Option Infer Off
Namespace TCPChat
Public Class TCPBroadcast
Public Property Message As String
Public Property BroadCastTime As DateTime
Public Property DestUser As String
Public Property OriginUser As String
Public Property PasswordHash As String
Public Property BroadcastSourceIP As String
Public Property BroadCastType As TCPBroadcastType
Public Property LoginUserName As String
Public Property FailureReason As String
Public Function XmlEncoding() As String
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim XML As String = String.Empty
Using memStream As New IO.MemoryStream
Using xmlWriter As New Xml.XmlTextWriter(memStream, System.Text.Encoding.UTF8) With _
{.Indentation = 4, .Formatting = System.Xml.Formatting.Indented}
serializer.Serialize(xmlWriter, Me)
End Using
XML = System.Text.Encoding.UTF8.GetString(memStream.ToArray)
End Using
Return XML
End Function
Public Function ToBinary() As Byte()
Return System.Text.Encoding.UTF8.GetBytes(Me.XmlEncoding)
End Function
Public Shared Function FromBinary(binary As Byte()) As DeserializationResult
Dim xml As String = System.Text.Encoding.UTF8.GetString(binary)
Return FromXML(xml)
End Function
Public Shared Function FromXML(xml As String) As DeserializationResult
Dim DeserializationResult As New DeserializationResult
DeserializationResult.Error = False
Try
Dim deserializer As New Xml.Serialization.XmlSerializer(GetType(TCPBroadcast))
Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(xml)
Using memStream As New IO.MemoryStream(buffer)
DeserializationResult.tcpBroadCast = CType(deserializer.Deserialize(memStream), TCPBroadcast)
End Using
Catch ex As Exception
DeserializationResult.Error = True
DeserializationResult.ErrorMessage = ex.ToString
DeserializationResult.AttemptedXML = xml
End Try
Return DeserializationResult
End Function
Public Class DeserializationResult
Public [Error] As Boolean
Public ErrorMessage As String
Public tcpBroadCast As TCPBroadcast
Public AttemptedXML As String
Sub New()
End Sub
End Class
Public Enum TCPBroadcastType
AdministrativeMessage
AuthenticationFailure
AuthenticationSuccess
ChatBroadcast
CredentialsRequest
Credentials
DisconnectedByServer
KeepAlive
PrivateMessage
ServerMessage
SystemMessage
UnableToProcessRequest
End Enum
End Class
End Namespace
“If you want something you've never had, you need to do something you've never done.”
Don't forget to mark
helpful posts and answers
! Answer an interesting question? Write a
new article
about it! My Articles
*This post does not reflect the opinion of Microsoft, or its employees. -
How to determine the address of the server whence the application through W
The application is loaded from the server taking place in Intranet networks. How to determine from this application the address of the server with which it it is loaded?
KSVUse could use the javax.jnlp BasicService.getCodeBase(). See http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/examples.html and http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/BasicService.html
-
How to get MAC address from client machine ?
Hi dear,
We are implementing security measures for a banking system, so it is required that we track the MAC address of the registered clients along with other parameters. How do we get the MAC address from client machine using ADF or running scripts in client side?
thanks allHi,
Welcome to OTN.
Your question has nothing to do with ADF as such. Googling would give you plenty of such topics.
-Arun -
How to determine the address of the server of loading app...?
The application is loaded from the server on the client computer by means of mechanism WebStart. How to receive (to calculate) from this application the address of this server of loading?
Beforehand thank for answers...
K$Vuse the BasicService in the JNLP Api:
public URL getCodebase().
see: http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/index.html
/Andy -
How to determine IP Address of user filling out form
I have an online form and one of the requirements is to show (and then submit) the ip address of the user filling out the form. How can I find out this information?
String ipAddress = request.getRemoteAddr();
Michael -
How to determine IP address in stored procedure ?
Hello :)
I want to determine caller's IP address from a stored procedure without having to receive it as parameter.
Thanks in advance
Nishuyou can use sys.dm_exec_connections
SELECT client_net_address, *
FROM sys.dm_exec_connections
WHERE session_id = @@SPID
http://msdn.microsoft.com/en-us/library/ms181509.aspx
Thanks
Saravana Kumar C -
How to determine the size of client in sap system
Dear Exports,
Pls suggest me how we can check the size of the client in oue sap system.
Thanks in advance.Hi Amit,
If you are not able to check the note 118823 or you can't able to find the solution. Just start client copy in test mode, there you can get the size of the client then you can cancel the client copy(which is in test mode).
Hope it will resolve your doubt.
Thanks
Kishore -
How to determine the Servlet which current request is mapped to
Hello folks,
having a filter, i want to discover the servlet (if any) which will serve the current request. I want to have it before the chain execution. Does someone has an idea how to accomplish this using Servlet API? The old API provided the getServlet(String name) method for this task. Here the sample code:
Servlet servingInstance = discoverServlerForRequest(request); //i look for implementation of this method
chain.doFilter(request,response);I know that it would be very easy to get the servlet AFTER processing the chain, but the clue for me is to get it before.
Maybe Tomcat has implemented some special servlet context attributes to map it?
any hint appreciated!
thanksits possible, for sure. but then I need two filters to achieve it. I'll post my solution later, if there wont be any other ideas. I know that tomcat maps many objects by attributes...maybe there is a key for it.
-
How to determine IP addresses of machines on network?
Is there a way to view a table of all the machines (computers, printers, whatever) on the network? I need an IP address of a print server and have no idea how to find it. On my old Linksys router, it provided such a table. Any way to on the AirPort Extreme?
Hallo David
Maybe the "arp" command might help you.
Open a terminal and enter
arp -a
It should print out a list of IP addresses that are wired
to the MAC addresses of all ethernet adapters in your network.
This does only work in you local network segment, not crossing any routers.
It might require "sudo arp -a", but printing out the table usually does not.
Have a nice christmas holiday,
Patrick -
How to trace IP address ports and request comming to network interfaces
Hi all,
I am using Solaris IP filter. I need to check the requests that is comming to a patiquler interfaces.
Is there any possibilities to get the IP address: Port, weather the request is Deny from the server etc....
Thanks.
VirajLian,
Did you find a solution?? If still looking, talk to Triometric, they can monitor and log this, a side effect of performance monitoring.
Have fun -
How to determine using MDM rich client OR thin client?
We want to save but also want to make sure nothing missing
SO could you tell me how to decide rich client or thin client?
Thanks!Hi Jessica,
MDM Rich Clients: A rich client is a networked computer that has some resources installed locally (MDM Components) but also depends on other resources distributed over the network (MDM SERVER). It Provides rich functionality.
e.g MDM Components (MDM Console, MDM Import Manager, MDM Data Manager and MDM Syndicator)
MDM Thin Clients: If a user only needs to perform select tasks and does not need all the functionality of a standard computer or program, a thin client may be the right tool for the job. e.g. SAP Enterprise Portal (Iviews for Search and Read access)
You can verify that MDM Components are Rich clients and SAP Enterprise Portal is a Thin client on page 4/41 Components in a MDM landscape as given in below link:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/284a5534-0601-0010-da9f-b70996d5ce90?quicklink=events&overridelayout=true
Regards,
Mandeep Saini -
How to determine ip address as static or dynamic
hi, im trying to figure out ways of testing incoming ip connections to my mail server as dynamic or static, would a simple get canonical name tell me this?
any adivce would be greatly appreciated
thanksWhether an IP is static or dynamic, it is just a decision of the IP administrator / owner. There is no technological measure in finding out such a human decision.
-
IP address of client of webdynpro application
Hello,
is it possible to determine IP address of client from webdynpro application?
Thanks in advance.
Zdenek Smolik.Hi Stefan,
We have developed application which is able to interactively update saplogon.ini file according to users needs. User can select systems which should be visible in saplogon offer. Because aplication backend has to connect to client's machine it needs to know its IP address. Because we have used webdynpro as user interface (backend is in R/3) we need to determine client's IP address here.
I have made a workaround using Java servlet but I am interested in possible webdynpro solutions.
Thanks and Regards
Zdenek
Maybe you are looking for
-
How to upload above20000 records csv files into oracle table,Oracle APEX3.2
Can any one help me how to CSV upload more than 20,000 records using APEX 3.2 upload process.i am using regular upload process using BOLB file SELECT blob_content,id,filename into v_blob_data,v_file_id,v_file_name FROM apex_application_files WHERE la
-
Is it possible to plug in an external HDD to the USB connection on my Airport Express for backups? As a kind of cheapo Time Capsule?
-
Help! SQL server database log file increasing enormously
I have 5 SSIS jobs running in sql server job agent and some of them are pulling transactional data into our database over the interval of 4 hours frequently. The problem is log file of our database is growing rapidly which means in a day, it eats up
-
Hi, yesterday i turned off my M100 by holding the power switch while it starts. Since the the power LED blinks orange when I turn it on and nothing else happens. I read that this means, that the BIOS is damaged. Is there a way to fix that or is this
-
Problems with cropping PDF in Automator.
I'm trying to create a workflow for a photo booth contraption I plan to set up at an event. 3 photos taken in each session will then be placed by the *New PDF contact sheet* action. All is well here except that now I need to crop the PDF (which i'm o