Contribute CS3 Client breaks the server XML
Well, I have found an interesting problem with the cthub XML
file that is stored in the "_mm" directory in the root folder of
your websites being administered by Contribute.
As you are no doubt aware, when at least one admin upgrades
to Contribute 4 or Contribute CS3 (aka 4.1) all the admins have to
since there are upgrades made to the XML files that control the
site. Well it appears that this upgrade makes the cthub file
non-valid XML.
Take a look at this file and look for the tag "font_use_css"
inside the "group_list_item" child node of the "group_list" node.
In a copy of the cthub file that was upgraded you will find that
this standalone tag is missing the appropriate closing slash. If
you compare this against a copy of the cthub file from before the
upgrade, assuming you made a backup, you will find that the tag is
properly closed.
Since this file is the master file with all of the role
information for the site, I wonder if this XML error is causing
unknown instability in the system somewhere.
I'm having the very same issue. Very frustrating. Support had me uninstall and reinstall. That did not wor
k, Then they had me uninstall and reinstall as a trial. That did not work. Very umimpressed with Adobe
products and support.
Anyone have a solution to this issue. I'm at the end of my rope.
Similar Messages
-
Contribute Cannot Connect to the Server
I am using a windows XP Pro computer, and have been using Contribute CS3 for over a year. About 3 weeks ago, I started getting the message, when I tried to connect to our website, which is hosted by a 3rd party, I got the following message: Contribute Cannot connect to the server. Please check your connection information of contact your administrator. Our connection type is SFTP.
I could not connect on my work pc, so I installed Contribute CS4 on my home computer and could not connect either. I also got our website developer to try and connect, and they could no longer connect as well. As our website host has assured us that no changes have been made on their system, I did a fresh install of a trial Contribute CS4 on a brand new computer (XP Pro) and this time was successful at making a connection.
If anyone has any ideas why the other 3 computers could not connect to the website, that would be appreciated.
ThanksI'm having the very same issue. Very frustrating. Support had me uninstall and reinstall. That did not wor
k, Then they had me uninstall and reinstall as a trial. That did not work. Very umimpressed with Adobe
products and support.
Anyone have a solution to this issue. I'm at the end of my rope. -
Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
I thought I will get an exception if the client or the server is not available but this is not happening.
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
How can I determine that the client or the server is no longer available?
Server
public class Server
private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
private TcpListener tcpListener;
private bool isStarted;
public event Action<string> NewMessage;
public async Task Start(int port)
this.tcpListener = TcpListener.Create(port);
this.tcpListener.Start();
this.isStarted = true;
while (this.isStarted)
var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
var cts = new CancellationTokenSource();
this.cancellationTokens.Add(cts);
await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
public void Stop()
this.isStarted = false;
foreach (var cancellationTokenSource in this.cancellationTokens)
cancellationTokenSource.Cancel();
foreach (var tcpClient in this.clients.Values)
tcpClient.GetStream().Close();
tcpClient.Close();
this.clients.Clear();
public async Task SendMessage(string message, IPEndPoint endPoint)
try
var tcpClient = this.clients[endPoint];
await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
catch (Exception exception)
private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
try
var stream = tcpClient.GetStream();
this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
while (!cancellationToken.IsCancellationRequested)
var data = await this.Receive(stream);
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
private async Task Send(NetworkStream stream, byte[] buf)
await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
await stream.WriteAsync(buf, 0, buf.Length);
private async Task<byte[]> Receive(NetworkStream stream)
var lengthBytes = new byte[4];
await stream.ReadAsync(lengthBytes, 0, 4);
var length = BitConverter.ToInt32(lengthBytes, 0);
var buf = new byte[length];
await stream.ReadAsync(buf, 0, buf.Length);
return buf;
Client
public class Client
private TcpClient tcpClient;
private NetworkStream stream;
public event Action<string> NewMessage;
public async void Connect(string host, int port)
try
this.tcpClient = new TcpClient();
await this.tcpClient.ConnectAsync(host, port);
this.stream = this.tcpClient.GetStream();
this.Process();
catch (Exception exception)
public void Disconnect()
try
this.stream.Close();
this.tcpClient.Close();
catch (Exception exception)
public async void SendMessage(string message)
try
await this.Send(Encoding.ASCII.GetBytes(message));
catch (Exception exception)
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
private async Task Send(byte[] buf)
await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
await this.stream.WriteAsync(buf, 0, buf.Length);
private async Task<byte[]> Receive()
var lengthBytes = new byte[4];
await this.stream.ReadAsync(lengthBytes, 0, 4);
var length = BitConverter.ToInt32(lengthBytes, 0);
var buf = new byte[length];
await this.stream.ReadAsync(buf, 0, buf.Length);
return buf;Hi,
Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
private async void Process()
try
while (true)
var data = await this.Receive();
this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
catch (Exception exception)
Console.WriteLine(exception.Message);
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Sending a certificate form the client to the server... how to ?
how can I send a certificate from the client to the server trough a Java code ??
Short answer: You specify a keyStore.
Either via command line using the -Djavax.net.ssl.keyStore=keystorefile property,
or in Java code:
char[] passphrase = "password".toCharArray();
SSLContext ctx = SSLContext.getInstance("TLS", "SunJSSE");
// KeyStore for the SSL client certificate
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream("client-cert.p12"), passphrase);
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509", "SunJSSE");
keyManagerFactory.init(keyStore, passphrase);
// keyStore for trusted server certs or CAs
KeyStore trustedKeyStore = KeyStore.getInstance("JKS");
trustedKeyStore.load(new FileInputStream("verisign-test-cert"), passphrase);
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
trustManagerFactory.init(trustedKeyStore);
ctx.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
SSLSocketFactory sslSocketFactory = ctx.getSocketFactory();
HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
// open the http connection to the party
myConn = (HttpsURLConnection)myURL.openConnection(); -
Generated either client or the server
which logs can be generated either client or the server?
I must be having a déjà vu... No, wait... you have posted this before:
logs can be generated -
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 automate accept client of the server side?
Hi.....
I am a beginner of using J2ME to developing my final year project. I have some problem of using bluetooth packet. I can't accept again the client message when the server accepted before. Any one can solve my problem? How can I using the loop or timer to accept the client message without using acceptAndOpen() packet? Thank a lot.....
The sample code is here:
- Server side
public class BluetoothServer implements Runnable {
private GameMIDlet gameMIDlet;
private HandleSetting setting;
private HandleScore score;
private ScreenGame screenGame;
private int playerMethod;
//private GUIGameServer guiGameServer;
StreamConnectionNotifier notifier;
StreamConnection conn;
LocalDevice localDevice;
ServiceRecord serviceRecord;
InputStream input;
OutputStream output;
private boolean isInit;
private boolean isReady;
private static String serverUrl = "btspp://localhost:" + ScreenMultiPlay.SHARE_UUID + ";name=GameServer;authorize=true";
public BluetoothServer(GameMIDlet gameMIDlet,HandleSetting setting, HandleScore score, int playerMethod) {
this.gameMIDlet = gameMIDlet;
this.setting = setting;
this.score = score;
this.playerMethod = playerMethod;
isReady = false;
isInit = false;
Thread accepterThread = new Thread(this);
accepterThread.start();
public void run() {
if (!isInit) {
// Initialization is done in the thread to avoid dead lock 'isInit' ensures it is done once only
try {
conn = null;
localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable( DiscoveryAgent.GIAC );
notifier = (StreamConnectionNotifier)Connector.open(serverUrl);
} catch (BluetoothStateException e) {
System.err.println( "BluetoothStateException: " + e.getMessage() );
} catch (IOException e) {
System.err.println( "IOException: " + e.getMessage() );
isInit=true;
System.out.println( "Starting Echo Server" );
try {
System.out.println("\n\nServer Running...");
isReady=true;
if (isReady) {
try {
screenGame = new ScreenGame(this.gameMIDlet,this.setting,this.score,playerMethod);
screenGame.start();
Display.getDisplay(gameMIDlet).setCurrent(screenGame);
} catch(Exception e) {
gameMIDlet.showErrorMsg(null);
// Pauses thread until Transmission occurs
conn = notifier.acceptAndOpen();
// Read Data Transmission
String msg = ScreenMultiPlay.readData(conn);
System.out.println("Received Message from Client: " + msg);
// Send Back a Message
msg = "Hello Back from Server";
output = conn.openOutputStream();
output.write(msg.length()); // length is 1 byte
output.write(msg.getBytes());
output.close();
} catch (Exception ex) {
System.err.println("Bluetooth Server Running Error: " + ex);
public void destroy() {
//isClosed = true;
// finilize notifier work
if (notifier != null) {
try {
notifier.close();
isInit=false;
} catch (IOException e) {} // ignore
// wait for acceptor thread is done
/*try {
accepterThread.join();
} catch (InterruptedException e) {} // ignore*/
-Client side
class BluetoothClient implements DiscoveryListener {
private GameMIDlet gameMIDlet;
private HandleSetting setting;
private HandleScore score;
private ScreenGame screenGame;
private int playerMethod;
private DiscoveryAgent discoveryAgent;
private RemoteDevice[] remoteDevices;
private UUID[] uuidSet;
private String serviceUrl;
public BluetoothClient(GameMIDlet gameMIDlet,HandleSetting setting, HandleScore score, int playerMethod) {
this.gameMIDlet = gameMIDlet;
this.setting = setting;
this.score = score;
this.playerMethod = playerMethod;
try {
LocalDevice localDevice = LocalDevice.getLocalDevice();
discoveryAgent = localDevice.getDiscoveryAgent();
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
//-----go to deviceDiscovered()-----------------
} catch (Exception e) {
System.out.println(e);
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
try {
// Get Device Info
System.out.println("Device Discovered");
System.out.println("Major Device Class: " + cod.getMajorDeviceClass() + " Minor Device Class: " + cod.getMinorDeviceClass());
System.out.println("Bluetooth Address: " + btDevice.getBluetoothAddress());
System.out.println("Bluetooth Friendly Name: " + btDevice.getFriendlyName(true));
// Search for Services
uuidSet = new UUID[1];
uuidSet[0] = ScreenMultiPlay.SHARE_UUID;
int searchID = discoveryAgent.searchServices(null,uuidSet,btDevice,this);
//-------------go to inquiryCompleted()----------------------
} catch (Exception e) {
System.out.println("Device Discovered Error: " + e);
public void inquiryCompleted(int discType) {
System.out.println("InquiryCompleted");
//---------------go to servicesDiscovered()------------------------
public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
System.out.println("ServicesDiscovered");
// in this example there is only one service
for(int i=0;i<servRecord.length;i++) {
serviceUrl = servRecord.getConnectionURL(0,false);
//---------------go to serviceSearchCompleted()--------------------
public void serviceSearchCompleted(int transID, int responseCode) {
if(responseCode == SERVICE_SEARCH_ERROR)
System.out.println("SERVICE_SEARCH_ERROR\n");
if(responseCode == SERVICE_SEARCH_COMPLETED) {
System.out.println("SERVICE_SEARCH_COMPLETED\n");
System.out.println("Service URL: " + serviceUrl);
StreamConnection conn = null;
try {
String msg = "Say Hello World";
conn = (StreamConnection)Connector.open(serviceUrl);
OutputStream output = conn.openOutputStream();
output.write(msg.length());
output.write(msg.getBytes());
output.close();
System.out.println(ScreenMultiPlay.readData(conn));
} catch (Exception ex) {
System.out.println(ex);
} finally {
try {
conn.close();
} catch (IOException ioe) {
System.out.println("Error Closing connection " + ioe);
if(responseCode == SERVICE_SEARCH_TERMINATED)
System.out.println("SERVICE_SEARCH_TERMINATED\n");
if(responseCode == SERVICE_SEARCH_NO_RECORDS)
System.out.println("SERVICE_SEARCH_NO_RECORDS\n");
if(responseCode == SERVICE_SEARCH_DEVICE_NOT_REACHABLE)
System.out.println("SERVICE_SEARCH_DEVICE_NOT_REACHABLE\n");This question isn't logical at all. You don't execute javascript on the server. But if you want to waste time on it. .. look at Rhino http://www.mozilla.org/rhino/
Best of luck... -
Monitoring an applet on a thin client from the server
Hello all,
I'm not even sure if this is possible or not, but here is what I would like to do.
I want to be able to monitor an applet running on a remote thin client device from the central server to determine if there have been any problems (exceptions, device failures, etc).
I'll be using java 1.5.0. If you require more info please let me know.
Thanks,But would anyone know if there is a similar method for applets?
What makes you think you can't use that technique in an applet? Use that, and contact the server when there's an uncaught exception.
You'll probably want to report a number of caught exceptions too (unless you're really bad at handling exceptions).
Best bet is to use a utility class on your applet with a method like "logError(Throwable t, String message)" which will send the details up to the server, maybe output to the console, maybe even pop up a dialog. If you did this via an interface you could plug in different implementations and compound them if required. -
How is the dsame client find the server ?
Hi,
manager = SSOTokenManager.getInstance();
token = Manager.createSSOToken(new AuthPrincipal("uid=amAdmin,ou=administrators,ou=topologymanagement,o=netscaperoot"), "abcdefg123");
amConn = new AMStoreConnection(Token);
I have above code fragment in a standalone Java application. The Java client could not find the server. I could not use Httprequest to get the server infomation. I tried token.setproperty("hostname",dsame. wad.com.au);
tolen.setproperty("port",58080);
But this doesn't help.
Thanks in advance!!
RaviPlease ignore the syntex errors in above code.
Thanks,
Ravi -
Unable to synchronise the client with the server
Hi Everyone,
I get the folllowing error while trying to sync my MI client for the first time.
Synchronization started.
Connection set up (without proxy) to: http://idesec7:50000/meSync/servlet/meSync?~sysid=ice&
Successfully connected with server.
Processing of inbound data began.
Internal server error; contact your system administrator.
any thoughts.....
Thanks in advance,
himaAfter synchronising with the server i am not able to start the MIclient it gives the error as <b>"start failed"</b>. But before synchronising, MIclient was working fine.This error has occured when i tried to download and start the aplication as an end user.in the webconsole the status is displayed as <u>"delete with next synchronisation"</u>.will this status in the webconsole matter.
the detailed information is as follows:
DEPLID E7D34F0264E5F64BBD740CCECB688CE0
INSTALLATION_IMAGE NO
JAVA_VERSION 1.4.2_06
JVM_VENDOR Sun Microsystems Inc.
MI_FULLNAME MI 25 SP 09 Patch 00 Build 200409101427
OSARCHITECTURE x86
OSNAME Windows XP
OSVERSION 5.1
PROCESSOR pentium i486 i386
RUNTIME TOMCAT
USERS_ON_DEVICE MISYNC-00; TEST; MI_ADMIN; MI_USER
USER_TIMEZONE Asia/Calcutta
can anybody help me in this.. -
Non Leopard client accessing the server
I have one machine in our office, a G5, that is not running snow leopard since it is not an intel machine. How do I configure that machine to join the server? All the other machines were done with login items in the account section, but that isn't available.
You should be able to use the Directory Utility, located in the /Applications/Utilities folder to manually bind to the Snow Leopard server.
-
2 Oracle Clients in the server
Guys,
we have a server which has an Oracle 8.1.7 installed. Since we developed a new .net application that requires Oracle 9iR2 Client, we have to install an Oracle 9iR2 also on the same machine. However, we are having problems executing stored procs that has an out parameter particulary with a clob datatype. I assume that the .net is still using the old oledb drivers of 8.1.7 instead of 9iR2. What should we do?I have a somewhat similar issue. I think your assumption may be wrong though:
"However, because the Oracle Provider for OLE DB is a COM component, only one instance can be active at a time. This means that a later OLE DB installation will render the previous one inactive." -
& in url breaks server.xml
I need to enter this url as my jdbc url in a <value> tag:-
jdbc:mysql://localhost/mydatabase?autoReconnect=true&autoReconnectForPools=true
but the & in the url breaks the server parsing the xml file.
How can I add this ?
tomcat 5.0.16Not only that, you are really supposed to escape the & character when you put that URL into an HTML file as well. The only difference is that XML doesn't allow malformed input whereas HTML accepts anything and tries to make something useful out of it.
-
Create the missing server.xml files yourself
Paula and I created the missing server.xml files ourselves. The script is at the bottom of the post.
We badly needed the missing server.xml files to work on the customizations and Oracle was unable to solve this problem.
"I checked on our Automated Release Updates System found that we dont have server.xml that includes PosDelivSchedVO. This confirms that there is no patch available at present to provide you with this file.
As this is not related to coding issue,Support will not be able to log a bug with Development. You may log an Enhancement Request via Metalink, so that Development would review your requirement and if feasible would include this file at the time of future releases"
#!/bin/sh
# This script is used to generate the missing server.xml files for $JAVA_TOP/oracle/apps/pos
# Usage: server.sh
# Note: This script has many hardcoded codes and it may generate the wrong server.xml.
# The manual fixes to the generated server.xml may be need.
# Check the codes before you use it.
# It's possible to write a generic version of this script to deal with more issues, like
# 1. dealing with the Oracle apps patches applied
# 2. only generates the missing server.xml files automatically
# 3. can specify the module, like pos or po ..., to generate server.xml.
# 4. including only the OA Framework objects used.
# 5. correctly generate the right "encoding"
# Luke Chi
APP=pos
PKG_HEAD=oracle.apps.$APP
PKG_TAIL=server
SERVER_FILENAME=server_1.xml
cd $JAVA_TOP/oracle/apps/$APP
# for SUB_DIR in asn isp lov product rcv sbd ship administration changeorder jar planning profile registration schema servic
es suppreg
for SUB_DIR in asn lov product rcv ship administration planning profile schema services suppreg
do
echo $SUB_DIR
cd $SUB_DIR/server
PKG=$PKG_HEAD.$SUB_DIR.$PKG_TAIL
cat << EOF > $SERVER_FILENAME
<?xml version="1.0" encoding='WINDOWS-1252'?>
<!DOCTYPE JboPackage SYSTEM "jbo_03_01.dtd">
<!-- \$Header: server.xml 115.11 2003/03/25 22:31:14 luke ship $ -->
<JboPackage
Name="server"
SeparateXMLFiles="true"
EOF
echo " PackageName=\"$PKG\" >" >> $SERVER_FILENAME
ls *.xml | grep -v server*.xml | while read FILE
do
BASENAME=`basename $FILE .xml`
cat << EOF >> $SERVER_FILENAME
<Containee
Name="$BASENAME"
FullName="$PKG.$BASENAME"
EOF
for TYPE in AM EO VL VO AO
do
BASENAME_2=`basename $BASENAME $TYPE`
if [ $BASENAME_2 != $BASENAME ]; then
case $TYPE in
AM) echo " ObjectType=\"AppModule\" >" >> $SERVER_FILENAME ;;
EO) echo " ObjectType=\"Entity\" >" >> $SERVER_FILENAME ;;
VL) echo " ObjectType=\"ViewLink\" >" >> $SERVER_FILENAME ;;
VO) echo " ObjectType=\"ViewObject\" >" >> $SERVER_FILENAME ;;
AO) echo " ObjectType=\"Association\" >" >> $SERVER_FILENAME ;;
CO) echo " ObjectType=\"Luke_CO\" >" >> $SERVER_FILENAME ;;
*) echo " ObjectType=\"Luke_UNKNOWN\" >" >> $SERVER_FILENAME ;;
esac
break
fi
done
echo " </Containee>" >> $SERVER_FILENAME
done
echo "</JboPackage>" >> $SERVER_FILENAME
grep Luke $SERVER_FILENAME
if [ $? -eq 0 ]; then
mv $SERVER_FILENAME server_error.xml
fi
pwd
cd ../..
doneWe loaded the Oracle seeded BC4J components from mid-tier file system to jdev OA Framework using the server.xml files generated by our Unix script attached in the privious posting above. We ,then did the customizations and successfully deployed them to our test Oracle apps.
-
Hi ,
I want to add the conext information to my server.xml of tomcat for my hibernate configuration.....
the conext information is as follows ....
<Context path="/quickstart" docBase="quickstart">
<Resource name="jdbc/quickstart" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/quickstart">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- DBCP database connection settings -->
<parameter>
<name>url</name>
<value>jdbc:postgresql://localhost/quickstart</value>
</parameter>
<parameter>
<name>driverClassName</name><value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>quickstart</value>
</parameter>
<parameter>
<name>password</name>
<value>secret</value>
</parameter>
<!-- DBCP connection pooling options -->
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
</ResourceParams>
</Context>
Where in my server.xml should i putI don't think you should have to edit the server.xml
at all. your app can have its own context.xml that
obviates the need for editing server.xml
%I did try that in many permutations. For some reason, the server.xml worked for me in 5.5 but not the context.xml. (Granted, it was late on Friday and I might have missed a step). :^)
- Saish
Maybe you are looking for
-
I just added an ACER x193w LCD monitor to my G4 Digital Audio. It initially recognized the monitor and type and gave me the appropriate resolution options in the display pref. After 2 days it now fails to recognize the model and just gives me the gen
-
Error - version `FUSE_2.7' not found
I have a problem mounting my ntfs partition with ntfs-3g. I post my problem to the ntfs-3g forum but they gave me no solution. plz have a look here. http://forum.ntfs-3g.org/viewtopic.php? - 003375866d Is this a bistro's bug? If yes then why it came
-
How To Delete Album Covers in iTunes?
Sometimes I want to delete the album covers I have for songs in iTunes. How do I do that? It'll add more than one cover but I can't seem to delete old or unwanted, or wrong album covers! Help! Lee
-
What is [abc-decode] in the profiler?
My app is showing a 58% self time on [abc-decode] during the loading. What is this? My loading is really slow, but I can't figure out why. Thanks!
-
Sending Hashtable[] to Bean from a JSP
Is it possible to send a Hashtable[] from a JSP to bean if possible how Thanks Srikanth