Communication between project inside or uotside the server
Hi,
I am wondering if it is possible to communication insede deployed project. For axample i got one project how deploy the connection application chek.
It is possible to ask for the connection chek EJB to call or start another application or web page (inside the same serveur and on remote server)
thanks a lot
Basically I have a host of Unix and NT boxes with a load of different files (test results). I have a central NT server which I want all files moved onto and deployed into a specific folder structure. So I need a Java method to allow remote retrival of the data, for the NT boxes this isnt a problem.
The system will need to be able to supply the password directly to the Unix boxes without a prompt from the user. I was working on an idea of using a remote copy procedure command, but dont know if this will work properly.
If at all possible I would rather avoid having added to the client boxes as there are a large number and new systems are added often. I was hoping to have a config file, listing IP addresses and username and passwords. I know the security issues with this and am prepared to accept it.
Any help with this is greatly appreciated!
Similar Messages
-
Communication between Two WebLogic instances on the same machine
Hi,
We're having a problem with communication between two copies of Weblogic on
the same machine. They are configured with seperate ports (regular and SSL).
Independantly, they run fine. I can access EJBs running on either of them.
The problem is that a bean in one of them has code which attempts to access
an EJB on the other one. The procude fails when trying to obtain the initial
context. This same code works if compilied independantly of WebLogic on the
same machine.
Are there any known issues regards communication between two running
instances of Weblogic on the same machine?
Thanks in advance,
Randy Yarger
marchFIRST
[email protected]Thanks for the prompt reply.
There is one IP address (internal address 10.227.1.34) one the machine. WLS1
is set up at ports 7001 and 5133. WLS2 is setup at ports 7004 and 7005.
When WLS1 attempts to obtain a context to WLS2 with the URL
t3://10.227.1.34:7004/ it pauses for a long period of time. Running truss
on the both WLS processes shows communication occuring between the two
followed by long periods of silence. Finally WLS2 spits out the error
ConnectionException[7001,7001,5133,5133,7001,7001] (paraphrased, I can get
the entire error if it would help).
After another long pause, WLS1 quits trying with the error 'Server
10.227.1.34:7004 not found' (again paraphrased).
Among the things we've tried:
* Changing the URL from the IP to 127.0.0.1
* Enabling/disabling SSL on either or both WLSs.
* Changing the server name in WLS2's copy of weblogic.properties from
'myserver' to 'myserver2' (previously they were both 'myserver')
* Upgrading WLS2 to 5.1.0sp5 (Tried upgrading WLS1, but was getting class
not found errors and quit because that WLS is being used by other people)
This is a Solaris server. WLS1 is running 5.1.0 and WLS2 is running 5.1.0sp5
Any suggestions would be appreciated.
Best,
Randy Yarger
marchFIRST
[email protected]
"Michael Girdley" <[email protected]> wrote in message
news:[email protected]...
>
>
There should not be. What is your network configuration? Are they on
separate IP addresses?
Thanks,
Michael
Michael Girdley
BEA Systems Inc
"Randy Jay Yarger" <[email protected]> wrote in message
news:[email protected]...
Hi,
We're having a problem with communication between two copies of Weblogicon
the same machine. They are configured with seperate ports (regular andSSL).
Independantly, they run fine. I can access EJBs running on either of
them.
The problem is that a bean in one of them has code which attempts toaccess
an EJB on the other one. The procude fails when trying to obtain theinitial
context. This same code works if compilied independantly of WebLogic onthe
same machine.
Are there any known issues regards communication between two running
instances of Weblogic on the same machine?
Thanks in advance,
Randy Yarger
marchFIRST
[email protected] -
Difference between compiling locally and on the server with FDS
Hi,
I am doing soming very basic testing with remote Java objects
and I am finding that if I create a FDS project and compile on the
server the code runs, if I create a FDS project and compile locally
it gives me the following error :
[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Connect.Failed error
NetConnection.Call.Failed: HTTP: Failed"]
what gives?
The compiler in Flex Builder string is :
-services "C:\Archivos de programa\Apache Software
Foundation\Tomcat
5.5\webapps\flex\WEB-INF\flex\services-config.xml" -locale en_US
Any insights?
DavidHi,
I am also facing an issue regarding compiling mxml using
remote objects using flex sdk. The error I am getting is
[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Security.Error error Error #2048: Security
sandbox violation:
http://localhost:9080/iReports/flexFiles/mxml/AdminServices.swf
cannot load data from
http://localhost:9080iReports/messagebroker/amf."
Can u help me?
Thanks,
Cheree -
IPhone SDK : Communication between iPhone client and a remote server
Hi,
This is w.r.t iPhone Cocoa Touch native application.
i need to populate my application 's data from a remote application server ( which in turn connects to the database) . I require some tips in the communication between client sitting on the iPhone and the remote application server. I am planning to proceed in XML transaction way.
I referred the SeismicXML sample application provided by Apple. In this sample,client reads the physically existing xml file from @"http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-M2.5.xml"; and the client parses the xml file and display the content on the table view.
i have following 2 queries ,
1. I do not want to read from a physically present file,i want the data to be transferred on the go.
Means, request should be sent from the client to a application server and the server process returns the data in form of xml file ( but its not creating any physical xml file) .
Basically i am looking for request - response concept.
2. Can we call a java process(which returns xml data) running on a remote server from the cocoa touch client.? If not java process,what would be other best way...
i am going through the Apple provided frameworks. Do any of the iPhone SDK frameworks support this request? If some one has any idea on the above mentioned queries, pls help me.
any pointers will also be helpful.
It might be too early to talk about these,but i have to take some business decision related on this.
thanks in advance.You already know how to send a string via HTTP Post? And you know how to make XML into a string? Put the two together.
-
I've recently started having this issue within the last few days. I started getting error messages saying that the sync server was incorrectly configured.
So I reset my sync data and then attempted to re-establish connectivity between my devices. Sync is now saying that my password is incorrect. I've reset my password twice and after each password reset I am getting the same error message saying that my password is incorrect. I should note that both times I double checked the password entry to rule out any fat-fingering lol.
Does anybody have any other information about this? I am wondering if a reinstall of Firefox will be necessary...thanks for any help you can provide! (:It sounds like there are a couple things going on here. First check if you have a successful install of SQL Server, then we'll figure out the connection issues.
Can you launch SQL Server Configuration Manager and check for SQL Server (MSSQLSERVER) if default instance or SQL Server (other name) if you've configured your instance as a named instance. Once you find this, make sure the service is started.
If not started, try to start it and see if it throws an error. If you get an error, post the error message your hitting. If the service starts, you can then launch SSMS and try to connect. If you have a default instance, you can use the machine
name in the connection dialog. Ex: "COWBOYS" where Cowboys is the machine name. However, if you named the SQL Server instance during install, you'll need to connect using the machine\instance format. Ex: COWBOYS\Romo (where Romo
is the instance name you set during install).
You can also look at the summary.txt file in the SQL Server setup error logs to see what happened on the most recent install. Past install history is archived in the log folder if you need to dig those up to help troubleshoot, but the most
recent one may help get to the bottom of it if there is an issue with setup detecting a prior instance that needs to be repaired.
Thanks,
Sam Lester (MSFT)
http://blogs.msdn.com/b/samlester
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
"Mark as Answer" and
"Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread. -
Communication between JApplet and Applet on the same web page
Hi Freinds
I have a JSP page containing two applets as follows :-
<jsp:plugin type="applet" code="TreePageJavaClass.class" codebase="/MYOA" width="200" height="300" name="Applet1">
</jsp:plugin>
<jsp:plugin type="applet" code="TreePageJavaClass2.class" codebase="/MYOA" name="Applet2" width="200" height="300">
</jsp:plugin>
First applet extends JApplet class and has a tree constructed using swing.
Second applet extends Applet class.
Now I want to call a method in second applet on selecting a particular tree node on first applet. I can call method on second applet from first applet when both extends Applet class (not JApplet)
So please tell me what's the problem here and how it can be solved.
ThanksThere is a Middle Eastern version of Adobe Dreamweaver CS4-ME, with full support
of Hebrew, Arabic, Farsi and other languages,
see http://www.fontworld.com/me/dreamweaverme.html -
I've been doing a lot of reading the last couple of days on how we can encrypt db communication between our product app and a customer's SQL Server db, but cannot make it work as expected. The app uses a ODBC/DSN to connect to the SQL Server db. I use this
ODBC app to setup the DSN (on a Windows 7 PC):
C:\Windows\SysWOW64\odbcad32.exe
The DSNconnection uses the SQL Server driver 6.01.7601.17514 and has these properties:
- WinNT authentication.
- Client Config button: TCP/IP to <server-name>\<instance.-name>
- Change to default db: <name-of-app-db>
- Everything else is default setting.
SQL Server is on the same Windowns 7 PC and has a self-signed cert installed (used IIS to generate it) and has the Force Enryption set to "yes".
I have a test C# program that uses the ADODB 2.7.0.0 COM-wrapper, made by Visual Studio after adding a reference to the ADO 2.7 library version 6.1.7601.17857. The program creates an ADODB.Connection object that has a simple connection string: "DSN=<san-name>;UID=<user>;PWD=<password>". The
program then creates an ADODB.Recordset object and reads and displays a field from a table.
Works fine.
If I go into SQL Server and set Force Encryption to "no," clear the cert, restart the SQL service, and then re-run the program, it works fine.
Here's the kick. If I go into the DSN and select "Use strong encryption for data" the Test button on the DSN works—why does it work? The SQL Server is no longer encrypting the connection so an error should occur. If I run the test program, it works
as well—why? I can look at the connection properties in the test program and see that ADODB has added the ";Encrypt-yes" stuff to the end of the connection string. Yet that option seems to have no effect.
If I set the SQL instance back to Force Encryption:yes, enable the cert, restart the SQL service, and clear the DSN's "Use strong encryption for data" option, I can still connect to the db with the
test program—why?
What am I doing wrong? I need to be able to ensure that the communication between our app product and the SQL instance is encrypted, and that we get an error if the SQL instance does not support encrypted communications. We really don't want the customer
to have to enable Force Encryption because they have other db's on their SQL Server that do not use encrypted communication, but they want to know that our product's communication channel with the db is encrypted.
No, I can't change the app product's code at this point in time. I'm stuck with working with what a DSN called from ADODB has to offer.
Also, how can I be sure that communications are encrypted? I mean, I've tried things like "SELECT * FROM sys.dm_exec_connections" but that doesn't help because I have no idea how to tie the list of sessions shown back to my test program, although
I guess it's a good thing that some of the sessions listed show encrypt_option as TRUE.
-glenn-Ah yes, very good point. It's easy to miss because you have to delete then recreate the DSN in order to change drivers. So I switched the DSN over to the SQL Native 11 driver.
Now when I try to connect to the SQL instance as <computer-name>\<instance-name>, and without a cert on the server, I get "the target principal name is incorrect". Perfect; now we're getting somewhere!
Change my DSN to use <fqdn>\<instance-name> and it works. This tells me that SQL Server has auto-generated a cert and named it <fqdn>. I would have expected the "cert fail" error, not a cert
name mismatch, because I'm not using Trust Server Cert.
So I load up my self-signed cert, and that works too.
I am still confused as to why I'm not seeing the "cert fail" error when I have no cert loaded on the SQL Server. I am not using Force Encryption on the server at all, so wouldn't expect SQL Server to auto-create a cert when an Encrypt=yes request comes in,
but apparently it does?
I also ran into a problem with this:
select c.session_id, c.encrypt_option, s.client_interface_name
from sys.dm_exec_connections c
join sys.sysprocesses s
on c.session_id = s.session_id
where s.dbid = db_id('MyDatabase')
There is no s.client_interface_name, probably should be s.hostname. There's also no s.session_id. I thought maybe this should be s.sid, but then no rows ever come back. The c.session_id looks like 51 and 52, but the s.sid looks like a very long binary number,
so these two fields cannot be joined. I don't know how to convert the sid's properly so that the join would work. Ah wait, I just found the s.spid column; the join works when that column is used (I assume that's correct anyhow).
If I add a Thread.Sleep(30 seconds) to my C# program just before the connection is closed, this query shows me the session for the correct hostname has encrypt_option=TRUE.
And I have to keep my fingers crossed that all the app I/O will still work properly after
changing the driver. Probably a safe bet though.
Think I'm ready to throw in the towel on getting the "cert fail/no SSL" error to appear.
It does look like I am able to sufficiently show that the connection is encrypted when Encrypt=yes is used with the newer driver.
Thank for all the help!
-glenn- -
I get the following error while saving a task inside task list:
"The server was unable to save the form at this time. Please try again."
I tried restarting "search service host controller".
The server has 8 GB RAM and according to task manager, 6.67 GB is being used.
I logged into the site with user which is the owner of the site. I tried creating tasks from client as well as the SharePoint server itself. Same error is shown in both the cases.
How do I find information on the exact problem that is causing the error? What are possible solutions?Hi robikshrestha,
This error message often shows when there is low memory that can be used, the workaround restart the “SharePoint Search Hosting Controller” service is to release some memory, and make it work. Whether restart the service release memory
in your situation?
Would you please check whether this issue happens all the time in task list, or happens sometimes when the memory is lower to use. If it doesn’t have a large impact, you can restart the server, check the result. have a look at the event
log and ULS log, see whether there is related information.
If it happens all the time, would you please use other browsers, whether the results are same? This may be caused by some add-ons in IE, like Free Download Manager I have seen.
Thanks,
Qiao Wei
TechNet Community Support -
Communication between JInternalFrame
Hi, I have a question on the communication between two separate JInternalFrames in the same GUI.
for example, Jinternalframe1 has a Jbutton (where action Command is already set and is ready to be caught in the actionPerformed() method). When I press the Jbutton in internalframe1, how can I create an Event in Jinternalframe2?
Thanks in advance.if you want to set the background for a button on the an internal frame from the other for example, you can do this :
public class MyFirstInternalFrame extends JInternalFrame
public JButton b1 = new JButton(...);
public MyFirstInternalFrame ()
b1.addActionListener( new Action.... Performed{
MySecondInternalFrame.b2.setBackground(Color.blue);}
public class MySecondInternalFrame extends JInternalFrame
public static JButton b2= new JButton(...);//must be public & static
public MySecondInternalFrame ()
I hope it will help you.. -
10.1.3EA: Purpose of Communication between System Boundary and UC
Hello,
What is the purpose of displaying communication between a System Boundary and a Use Case? On the diagram, you can even show communication between a UC included within the system boundary.
Just trying to figure out how that would be used and why...
The tooltip on the Communication elements has:
"Defines where an actor communicates with a use case"
Thanks.Hi,
This is probably a slightly controversial ability; but after much research we have found this is to be valid UML. The reason for this support is that some objects, depending on the context, might well need to be represented on the diagram as either a actor or a system boundary.
Take for example a computer system called "Accounting System". On some high level diagram you might want to represent this as a computer that plays a role in a usecase. At a lower level you might want display this element as a System Boundary that contains sub usecases.
Does this make sense?
Gerard -
Communication between the DNS/DHCP Manager and OES Server
No communication between the DNS/DHCP Manager Console and OES server (status,start,stop)
The screenshot shows the tab "DHCP (OES Linux)" in the DNS / DHCP Manager console
in the bottom of the image it shows the state of the DHCP servers.
allDHCP.JPG
The dhcp service is started on all these servers
You can see that the status is known only for four servers.
The button "start/stop DHCP service" works fine on this servers and
the dhcp service can be canceled and also restarted
But the status of the "dhcp service" is not recognized for all the other DHCP servers
and so we can not start or stop dhcp service on these servers.
All servers were installed at different times (last three years) with OES11 and
are upgraded to OES11SP2 with all patches.
The server keto (DHCP_keto) is a new installation OES11SP2 few days ago.
All OES servers were set up identically from me. LDAP, LUM, DMS, DHCP works fine.
Which service on the OES server is responsible for
communication (status indicator) between the DNS/DHCP Manager and the OES serve?
How the status query is performed by the DNS/DHCP Manager?
How can I test the communication to the server on the client (console)?
Which configurationfiles I should be compare on the server?
Thanks in advance
Gernotgernot,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://www.novell.com/support and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Forums Team
http://forums.novell.com -
Communication between the primary server the gateway server
hallo
Can I set the directional communication between the primary server the gateway server, so it feels by the following example?
And if so how?
Agent
à GW
ß GW
ß MS
*Agent communicates with GW1 and reported it
*GW SEND report to GW2
*GW2 Send the the data to MS
thanks
<o:p></o:p>
אם תגובתי פתרה את בעייתך - לחץ/י, על "סמן כתשובה" ליד סימן ה V הירוק.Hi,
As far as I know, Gateways dont talk to each other. Why you need two GW, with one GW and report to your management servers, this way should work.
Here is a similar thread for your reference:
https://social.technet.microsoft.com/Forums/systemcenter/en-US/323d5aab-bad4-4c23-b096-27a62757ae31/communications-between-2-gateway-servers-and-2-ms?forum=operationsmanagerdeployment
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Error in the Socket Communication between Java Client and VC++ Server
In my application, using Java Client to do socket bi-communication with VC++ Server, which is done by somebody else.
The error is after the application properly running one or two days, the VC++ Server cannot receive the messages passed by java Client, but at Java client, everything is the same, although using CheckError() after every print(), there is no exception thrown.
The JVM is jdk1.3.1, platform is Win2k Server.
The outputstream is PrintWriter().
Please help me to settle down this problem. Thanks in advance.I read some thread in the forum, and found somebody had the similar problem with me. Just want to know how to settle this problem.
In the client/server program. Client is a JAVA program and Server a
VC++ program. The connection works, and the problem appears after some time. The Client sends a lots of requests to Serverm, the server seems receive nothing. But at the same time, the server is able to send messages to Client. The Client also can get the messages and handle them. Don't understand why there this problem and why it appears when it wants.
The client is a Win2k platorm with JDK1.3.1 and the server is also a Win2K platform with VC++ 6.0.
In the Client, using:
inputFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
outputToServer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
Hope can get your help. -
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. -
Communication between two Macs Server
Communication between two Macs Server:
Can they work together and communicate and interact normally in a PowerMac network, OS X 10.5.8 Server installed, and a MacPro computer that is running Server 4.0.3 on Yosemite? Had to do some additional implementation?
Regardsfrom the JavaDocs:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html
getContext
public ServletContext getContext(java.lang.String uripath)
Returns a ServletContext object that corresponds to a specified URL on the server.
This method allows servlets to gain access to the context for various parts of the server, and as needed obtain RequestDispatcher objects from the context. The given path must be begin with "/", is interpreted relative to the server's document root and is matched against the context roots of other web applications hosted on this container.
In a security conscious environment, the servlet container may return null for a given URL.
Parameters:
uripath - a String specifying the context path of another web application in the container.
Returns:
the ServletContext object that corresponds to the named URL, or null if either none exists or the container wishes to restrict this access.
See Also:
RequestDispatcher
Maybe you are looking for
-
the application seems to be : static-cdn.addons.mozilla.net
-
Connect iMac 2011 as a display for another iMac 2011
Hello. I have two iMac's 2011, and want to use one of them as a display for another. Is there any way to do that? Best regards, Alexey
-
Differences display Macbook versus Macbook Pro - fact or fiction?
"There is a substantial difference between the quality of the display of the Macbook and the quality of the display of the Macbook Pro (both: late 2008)." Is this fact or fiction? Please explain your answer as much as you can
-
This website is way too much for the simple guy wanting to know a simple answer to a simple question about an iPad 2 or a iMac!!!!!
-
Re-installing windows after upgrading hard drive?
Hi, Ive been searching through Google and on this site but I keep finding info on how to upgrade the hard drive or how to upgrade windows but I cannot find the answer to my specific question. How do I install windows on my Satellite A305-S6905