Accessing host address from client application.
How can I determine in my Client application (launched via webstart) the host where my application was downloaded from?
<http://java.sun.com/products/javawebstart/docs/javadoc/javax/jnlp/BasicService.html#getCodeBase()>
E.G.
try {
BasicService bs = (BasicService)ServiceManager.lookup(
"javax.jnlp.BasicService");
URL codebase = bs.getCodeBase();
System.out.println( "Codebase: " + codebase );
} catch(UnavailableServiceException e) {
e.printStackTrace();
}Note that you need to add the javaws.jar to the compilation classpath for the code snippet to compile cleanly.
Similar Messages
-
How to pass XML file as a input to DataService from client application
Hi,
I have a function in DataService which will take a complex parameter as input. So from client application how can I pass the Complex parameter?
If anyone knows please help me.
thanks,
Suresh varmaSomething like this. The types will be generated when you Generate SDO Mediator client.
somenamespace.MyComplexParamDocument myComplexParamDoc=
MyComplexParamDocument.factory().newInstance();
MyComplexParam myComplexParam=myComplexParamDoc.addNewMyComplexParam();
myComplexParam.setFirstName("John");
CUSTOMERPROFILEDocument[] myCust =
customerDS.getCustomerByComplexParam(myComplexParamDoc); -
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 -
Accessing HttpService proxy from Flex Application
Hello,
I am new to flex development. I had a question about configuring HttpService proxy access from my flex client to my BlazeDS server. From the examples, I can define my HttpService in my flex application as:
<mx:HTTPService id="srv"
destination="catalog"
useProxy="true"/>
I understand that I need to define my http service definition in the proxy-services.xml file in the BlazeDS deployment. So the BlazeDS deployment is on a different host to the client. How does the flex client access the HttpService definition and how to contact the server? Is the proxy-services.xml file deployed with the client? My current development environment is Flashbuilder 4. Do I need to install the proxy-services.xml file in my Flashbuilder project? Thanks in advance.
--Marcohow did you get it, how were you able to set the location of you blazeds server? i know with remoteObjects we can use channelset.
-
When browsing documente library contents from client application, cannot see all files
We are currently running SharePoint 2010 Enterprise in a small environment. On one of my sites, I have a document library with various documents uploaded (docx, xlsx, pdf). I am unable to see all the documents when browsing the library from Word/Excel/Adobe
Acrobat. For example:
- At the root level of the library, I have 5 folders
- In Folder 1, I have 10 PDF files
- If I go into Adobe Acrobat 11, for example, and paste the address of my site in, I can see the library and I can click on it and see the 5 folders. If I click on Folder 1, there are no PDFs listed. Even changing File Type to "All Files"
still returns 0 results
Things I have tested:
If I view the library in the browser, I can see the 10 PDFs in Folder 1. They are not checked out and they are visible to everyone
If I click Library>Open w/ Explorer, I can see all 10 PDFs in Folder 1
If I try using other client applications (Word, Excel, etc..), I cannot see any files in Folder 1, even when I change the File Type to "All Files"
If I click in some of the other Folders in the same library from within a client application, sometimes I can see the files but most times I cannot
What could be causing this? I do not see any errors in any of the event logs.Hi Sephiroth,
I think my observation is when you browse from word/Excel/Adobe it is taking your local system credentials and so not showing files when you access.
local system account means the account which you used to login to the system.
For example,you logged into the system as contosomo\xyz and you are trying to connect to the site using Contosomo\setup account,what my point is though you logged in to the site using the setup account site is taking your xyz account credentials and so it
not showing any files as xyz obviously will not have access.
To confirm this, you can try by giving atleast read access to the local system account (in this case xyz) to the library and then test again whether you are able to see the files or not.
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem.
s p kumar -
Unable to access Scan IP from clients!
Dear All,
I am posting this question again, I am still struck here. I cant access my Database 11gR2 on Linux from clients like toad, using scan IP address.
I have struggled a lot but couldnt find anything helping me.
Kindly help. This is the status of my database currently:
Output of crsctl status resource -t is
ora.etisldb.db
1 ONLINE ONLINE racnode1 Open
2 ONLINE ONLINE racnode2 Open
SQL> select name, enabled from dba_services;
NAME ENA
SYS$BACKGROUND NO
SYS$USERS NO
etisldbXDB NO
etisldb NO
Status of listener from one of the RAC node
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 19-MAR-2012 16:47:06
Uptime 0 days 18 hr. 55 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/racnode1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.168.20.31)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.168.20.32)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "etisldb" has 2 instance(s).
Instance "etisldb1", status UNKNOWN, has 1 handler(s) for this service...
Instance "etisldb1", status READY, has 1 handler(s) for this service...
Service "etisldbXDB" has 1 instance(s).
Instance "etisldb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@racnode1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node racnode1
vi /etc/hosts
# Single Client Access Name (SCAN)
10.168.20.29 etisldb-scan
[grid@racnode1 ~]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
When I run srvctl status service -d etisldb (I think this is where the problem lies)
It shows nothing, not even error.
My Service Name is etisldb and instance name is etisldb1
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
tnsnames.ora
ETISLDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.168.20.29)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = etisldb)
etisldb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.168.20.29)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)(SERVICE_NAME = etisldb)
(INSTANCE_NAME = etisldb1)
listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = etisldb)
(ORACLE_HOME = /u01/app/11.2.0/grid)
(SID_NAME = etisldb1)
SID_LIST_LISTENER_SCAN1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = etisldb)
(ORACLE_HOME = /u01/app/11.2.0/grid)
(SID_NAME = etisldb1)
Still I am unable to access RAC when i give service as RACDB and IP 10.168.20.29. If you require any other information kindly let me know.
Kindly Help,
ImranHi Imran,
If you are going to use SCAN for serious client connectivity , then it should be registered with the DNS .
Putting SCAN name in /etc/hosts file will only provide you a workaround during installation.
If you don't have a DNS setup , then use tns entries with VIP names.
If you want to use SCAN for client connections, then
1. configure SCAN in DNS and make sure nslookup scan-name resolves to 3 IPs
2. Use SCAN name rather than IP for HOST in your tnsnames, jdbc URL . Currently you've set IP in your tnsnames , (HOST = 10.168.20.29 )
3. Now, set REMOTE_LISTENER = scan-name:port on all nodes so that SCAN listener can handover the client connections to the least loaded local listeners. -
Getting IP address from client
Our application suite is a mish-mash of client-server, web-applications and web pages. One of the requests by our client is to allow them to login into one application and then go directly to another without having to enter their password again. One method we thought of is to capture the IP address of the client when they login, or posssibly send it with the login request. Is there an easy reliable way to do this? The other method I thought of is after logging in the client would be given a key. Where could I store this key? I was thinking in the registry but I am trying to avoid Windows specific design.
On a side note I am looking at JAAS. It seems that JAAS just gives us a standard access interface, does it the features I am looking for by any chance?Use an application bean if you want to keep a list of
all the users stored on a server.
When someone logs on, grab the ip, login name, and
password. Store this in the application scope bean.
Every time a page is accessed, check the ip to see if
it has been previously stored in the bean. If so,
load the login and password and use them for logging
in to the page. If not, include another preset login
page, or lik to it with the previous page stored in a
session scope bean.
The ips, login names, and passwords should be enclosed
in a class (simple one with three fields). When
someone logs on, create a new instance and send it to
the application scope bean, where it should be stored
in a java.util.HashMap (my favorite kind, and really
quick).
There should also be a way to time-out the user after
a while of not connecting - removing their ip from the
application scope bean. Very important if you want
security.
That's all I can think of for now.
Spaceman40Close enough, however I will point out that you don't need to store the password. I am also confused why you are saying an application level bean. This needs to be a bean that can be accessed by all of our applications. If one application creates the bean all of them should be able to see it.
I was thinking of doing this: Each application gets a session bean that looks for an entity bean with the primary key of the client's IP address. If the bean is there it gets the user ID from that and logs that user into the system. If the bean isn't there, it fires off a login procedure for the client to enter their username and password. If the login is successful it creates the bean. The session bean stays around until the user logs out of the system. The last session bean linked to that entity bean destroys it.
Has anyone seen this before? Is there a design pattern for a last one out turn off the light in EJB? -
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. -
Error while invoking a Dataservice from client application
Hi,<br><br>
Code snippet of Client to invoke DataService is....<br><br>
Hashtable h = new Hashtable();<br>
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");<br>
h.put(Context.PROVIDER_URL,"t3://10.1.5.31:7001");<br>
h.put(Context.SECURITY_PRINCIPAL,"weblogic");<br>
h.put(Context.SECURITY_CREDENTIALS,"weblogic"); <br>
Context context = new InitialContext(h);<br>
DataService ds =DataServiceFactory.newDataService(context, "HLCApp","ld:HLCAppDataServices/com/pfizer/hlc/dataservices/HCP_DETAILS"); <br>
<u>DataObject obj= (DataObject) ds.invoke("HCP_DETAILS", null);</u><br>
System.out.println(" HCP details : \n" + obj);
<br><br><br>
The line(which is underlind) is causing the error(I checked by putting some System.outs).
<br>
While invoking a DataService from the Client application(Java Client) I am getting the following error in the console.
<br><br>
Exception in thread "main" com.bea.ld.dsmediator.client.exception.SDOMediatorExc
eption: com.bea.ld.dsmediator.client.exception.SDOMediatorException: weblogic.rj
vm.PeerGoneException: ; nested exception is:
java.io.EOFException
at com.bea.ld.dsmediator.client.XmlDataServiceBase.invoke(XmlDataService
Base.java:114)
at com.pfizer.hlc.DSClient.HCP.main(HCP.java:23)
Caused by: com.bea.ld.dsmediator.client.exception.SDOMediatorException: weblogic
.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException
at com.bea.ld.dsmediator.client.XmlDataServiceBase.invokeQuery(XmlDataSe
rviceBase.java:183)
at com.bea.ld.dsmediator.client.XmlDataServiceBase.invoke(XmlDataService
Base.java:102)
... 1 more
Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.j
ava:108)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:290)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:248)
at com.bea.ld.Server_ydm4ie_EOImpl_816_WLStub.executeFunction(Unknown So
urce)
at com.bea.ld.dsmediator.client.XmlDataServiceBase.invokeQuery(XmlDataSe
rviceBase.java:157)
... 2 more
Caused by: java.io.EOFException
at weblogic.rjvm.t3.T3JVMConnection.endOfStream(T3JVMConnection.java:897
at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.ja
va:599)
at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:549)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:707)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:654)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:2
82)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
32)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
<br><br><br><br>
<b>And in the server's log file the exception is like below</b><br><br>
<Nov 1, 2006 4:29:31 PM IST> <Error> <RJVM> <gsipl-c2-8> <cgServer> <ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'> <<WLS Kernel>> <> <BEA-000503> <Incoming message header or abbreviation processing failed
<b>java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940</b>
java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940
at java.io.ObjectStreamClass.initNonProxy(Ljava.io.ObjectStreamClass;Ljava.lang.Class;Ljava.lang.ClassNotFoundException;Ljava.io.ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava.lang.Object;(Unknown Source)
at weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:33)
at java.io.ObjectInputStream.readExternalData(Ljava.io.Externalizable;Ljava.io.ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava.lang.Object;(Unknown Source)
at weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:65)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:37)
at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.java:212)
at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.java:251)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:748)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:782)
at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
<br><br><br>
<b>My workstation environment is</b>
Weblogic 8.1 SP6,Aqualogic 2.0 ,os is WindowsXP and JDK is jrockit81sp6_142_10.
<br><br><br>
Does anyone have any idea, why i am getting this error.
<br><br>
Thanks,<br>
Suresh varma.Hi Suresh varma
Did you get any answer for your problem?
I'm having the exact same problem. Working with Weblogic 8.1 SP6 and getting this strange message whenever I'm calling my data service.
I've followed the guidlines given on the URL posted here, and still getting the same message.
Let me know if you have any idea.
Cheers
Rod -
Can't Access Aperture Photos from Other Applications
I am using the trial version of Aperture. I can't access the photos in Aperture from Photoshop, Word or any other application (except Mail). I can see the icon for Aperture and the words "Aperture 3 Trial Library" but it is grayed out. Is there a setting or what? I have Snow Leopard and Mac OS X 10.6.5.
I guess one thing that bothers me about all my pictures being "bundled" in iPhoto or Aperture is that they don't show up in the Finder.
This is a real non-issue. A Package is simply a folder that looks like a file. Want to look inside? Go to your Pictures Folder and find the iPhoto Library or the Aperture Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
See? There are all your files, in folders.
Why are they Packaged? Because if you move, rename, or alter them then you will corrupt your Library. So it's a simple protection for the structure of the Library. That's all. No big secret.
But there are other things you need to consider too.
Supposing you want to attach a file to an Email in Aperture. Presumably you want to send the edited file of your photo. So, how do you do that +when there is no edited file+? Aperture doesn't actually edit the file at all it simply records the decisions you have taken and shows them to live when you view the pic. All your edits are "virtual". So, the fact that your original files are stored out the the package will be no help to you at all.
iPhoto is pretty much the same - though the details are different.
So, you have to use the applications when you want to access the files for whatever reason - editing, printing, sharing, whatever. That's the point of these apps. They are your Photo Manager, what AddressBook is to your Contacts, iTunes is to your Music and so on.
Here's a macro I use for when these questions come up on the iPhoto Forum. Most - if not all - of these will also work for Aperture:
You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
Uploaded with plasq's Skitch!
*_(Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)_*
You can access the Library from the New Message Window in Mail:
Uploaded with plasq's Skitch!
If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto or Aperture
If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
*If you want to access the files with iPhoto or Aperture not running*:
For users of 10.6 and later:
You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
*File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. This produces, producing a copy.
Regards
TD -
Encoding Error when invoking form from client application.
I have an issue in retrieving the form data from the client application. Form (XDP File) is displayed in the browser as PDF through
ServletOutputStream then i am trying to retrieve the data on click of the submit button. At that time the following exception is thrown:
[8/17/07 9:20:18:212 EDT] 00000029 jsf E com.sun.faces.application.ViewHandlerImpl setRequestEncoding SRVE0254E: Failed to set request character encoding: ["utf-16"].
java.io.UnsupportedEncodingException: SRVE0254E: Failed to set request character encoding: ["utf-16"].
at com.ibm.ws.webcontainer.srt.SRTServletRequest.setCharacterEncoding(SRTServletRequest.java :231)
at javax.servlet.ServletRequestWrapper.setCharacterEncoding(ServletRequestWrapper.java:158)
at com.sun.faces.application.ViewHandlerImpl.setRequestEncoding(ViewHandlerImpl.java:364)
at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:267)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:158)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:239)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink .java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink .java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.jav a:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionLi stener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
Note: I am able to retrieve the data, if I store the same PDF file in the local disk and invoke it from my JSP Faces file.
i appreciate if any one can help me to resolve this issue.Please update me if any one have idea on this issue.
-
Accessing another variable from another application
I was wonder how I can access another variable form another application?
For example: I want to access :P4_EMPLOYEE_NAME from app ID 104 when I am doing is from an activity in page 2 on app ID 142.
I had a search before, but I am looking for an unambiguous response.Greg - About all you can do is call the function htmldb_util.fetch_app_item(p_item => 'F104_ITEM', p_app => '104'). The application you call this function in must be sharing a session with the application from which you are fetching the item, both applications must belong to the same workspace, and the item you name in the argument must be defined as an application-level item in the fetched-from application.
Scott -
Access HTML Pages from Forte Applications
We are currently looking at how to redevelop our online help facility for a
Forte application. We are investigating the use of HTML pages.
Has anyone written a Forte application that opens particular HTML pages? If so,
how was it done?
Regards,
Steve Isaac
Senior Consultant, Information Services Group
Hydro Electric Corporation of Tasmania
4 Elizabeth St, Hobart, Australia, 7000
Phone : +61 03 6230 5161
e-mail: [email protected]We have created the idea of an OnLineAssistant that uses HTML pages to drive
help in a Wizard-like fashion.
We use an embedded ActiveX browser control in a Forte window to display the
HTML pages. The pages are launched by passing the application, window, and
widget name to the OnLineAssistant window, which uses the information to load
the correct page.
For example: an application screen for entering customer name and address
passes it's information to the on-line assistant, which links and displays the
page associated with that particular step of a task wizard defined for that
widget. The ActiveX control then allows the user to link into any of the
other pages associated through standard HTML.
This context-sensitive mechanism is also used to launch on-line help (without
the task orientation) at the user's request.
One of the benefits of this approach is that we can put the message passing
into a generic framework ancestor without making any application code changes,
and the OnLineAssistant HTML pages can then be created by non-programmers and
deployed independently from the application, and HTML can do most of the
navigation work.
-DFR -
Finding IP address from Client ID?
From an Android tablet: How do I find the IP address of a computer in my network if the know the client ID? It's easy from a desktop: I just bring up Hamachi and everything is revealed. If I use the tablet browser to view my Hamachi networks (at the Hamachi site), the page is compressed horizontally and part of the IP address is hidden. Apologies if I have missed this in the documentation or knowledge base.
try
request.getRemoteAddr() to get IP of Client
request.getRemoteHost() to get HostName of Client
"Matt Raible" <[email protected]> wrote in message
news:3a9c1efc$[email protected]..
> Does anyone know how to obtain the IP address from the client? I need to
> get it in a servlet to set it as a session variable.
>
> Thanks,
>
> Matt
>
> P.S. Please send reply to [email protected]
>
>
-
Accessing a variable from different application instance in fmis
Hello everyone i like to know how to declare a global variable in FMS, so that i can access it from different application instance of a same application.
Thank.Hi,
In such a use case you can use persistent shared object to keep track of all connected users and the instances they are connected to. then when a user connects in application.xml you can check whether that user name and password is valid for a instance. This doc should help you get this achieved http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d3 7a-7fff.html
Thanks,
Abhishek
Maybe you are looking for
-
How can I tell if my iPod touch 5 is jailbroken?
I Don't know if I jailbroke my device or if this can cause a jailbrake but I downloaded a jailbroken app, it was meant to be downloaded by jailbroken devices not non-jailbroken devices so I downloaded it on my iPod and I haven't jailbroken my iPod an
-
I have this method: void ExpandToLevel(TreeNodeCollection nodes, int level) if (level > 0) foreach (TreeNode node in nodes) node.Expand(); ExpandToLevel(node.Nodes, level - 1); I added now a new method: void CollapseToLevel(TreeNodeCollection nodes,
-
hi all. can anyone help me find a thread (can i run a search somehow in ("Your Stuff"?) where folks were kind enough to help me understand how to change file names? i am reading through some help documentation on Batch Change but i am trying to remem
-
Maximize page to fit screen width
Hi, I would like to maximize all the pages of the application to fit the entire screen size i.e. effect similar to F11. Please let me know how it can be done at application level. Thanks.
-
Starting managed servers using Nodemanager
When I try to start a manage server using the nodemanager sitting on the same machine as the Admin Server and the nodemanager itself, I get the following message: <Error> <NodeManager> <Could not start server 'serverA' via Node Manager - reason: '[Se