Help needed regarding the client server communication

this is regarding my networking project which at present i am doing it in java...
the project is abt establishing a server in my lab that controls all the other systems in that lab... now the problem is i have to shut down all the systems in the lab from the server on a click of a button.... this i need to do using socket programming to which i am new....
So can anyone pls send me a sample code as to how to pass a command from server to shut shut down all the systems(clients) ..i need a java program that uses sockets concept to perform the above mentioned operation...pls note i am trying to establish a linux server
regards
lalita

Dear hiwa
i can use it but the constraint in my project is to use only the Socket programming due to time lacks.... i have to find a faster way to communicate between the server and the client...
can u pls help me find a solution for this via sockets...
hoping a favorable response
regards
Lalita

Similar Messages

  • Help needed regarding the updation of "Relationships" in BP

    Hello Guys,
    This is to request you to kindly help me regarding the following.
    We have a scenario where all the employees assigned to an Organizational unit (in PPOMA_CRM) are not showing in the "Relationships" ("Has Employee")in the BP transaction of that Organizational Unit.
    Could anyone let me know whether there is any update program that updates the "Relationships" from the Organizational asssignment. Or we need to enter the employees manually in BP "Relationships". Please help. Thanks in anticipation.
    Regards,
    Kishore.

    Hi Amit,
    Thanks alot for your reply. Its really helpful for me.
    So,we usually enter these relationships manually only, right? Before going ahead with the custom program, could you please let me know whether there is any SAP note related to this.Once again thanks alot for you help.
    Regards,
    Kishore.

  • Help needed regarding the deployment architecture for PROD env

    Dear All,
    Please help me with some clarifications regarding the deployment architecture for PROD env.
    As of now I have 2 single node 12.1.1 installations for DEV and CRP/TEST respectively.
    Shortly I will be having a PROD env of 12.1.1 with one DB node and 2 middle tier (apps) node. I need help in whether -
    1) to have a shared APPL_TOP in the SAN for the 2 apps node or to have seperate APPL_TOPs for the 2 apps node. The point is that which will be benificitial in my case from business point of view. The INST_TOPS will be node specific in any case right?
    2) Where to enable the Concurrent Managers, in the DB node or in the primary apps node or in 2 apps node both for better performance.
    12.1.1 is installed in RHEL 5.3
    Thanks and Regards

    Hi,
    Please refer to (Note: 384248.1 - Sharing The Application Tier File System in Oracle E-Business Suite Release 12).
    For enabling the CM, it depends on what resources you have on each server. I would recommend you install it on the the application tier node, and leave the database installed on one server with no application services (if possible).
    Regards,
    Hussein

  • Help Needed With Basic Client/Server App

    I was wondering if anyone can help with a simple blackjack client/server application i've been writting (basically its a moddified chat application). The problem i'm having seems to lie within the connection management i've written.
    What i'm trying to get is that only 4 players can connect at one time and that each player takes a turn (which i've implemented using threads) to play their hand (as you would if you were playing it for real). The problem is that it will allow the players to connect, but oddly enough, it will not allow a new transaction to be created (i.e. allow a player to take their turn) until 2 players have connected.
    Even when it does create the transaction, after taking input from the client once, the server seems to stop doing anything without any error message of any kind.
    Its really annoyed me now, so you guys are my last hope!
    The code can be found in full here:
    Client Application: http://stuweb3.cmp.uea.ac.uk/~y0241725/WinEchoClient.java
    Server Application: http://stuweb3.cmp.uea.ac.uk/~y0241725/ThreadServer.java
    Card Class: http://stuweb3.cmp.uea.ac.uk/~y0241725/Card.java
    Deck Class: http://stuweb3.cmp.uea.ac.uk/~y0241725/Deck.java
    Please feel free to play around with this code as much as you feel necessary!

    (one last bump back up the forum before i give up on this completely)

  • Help needed regards the usage of STL.....with CC

    Hi All,
    I am relatively new to SOLARIS. I am trying to figure out the options for using the STL components in the project.
    The project needs to be compiled with both CC ang g++, should support both SOLARIS and LINUX systems. That's why i am going for STL components rather than using the RW-Components of Tools.h++.
    I have the following doubts regards the usage of STL.
    CC provides the -library option to link the libraries we require.
    The following is what i understood from the documentation:
    No ( -library ) option provides - default libraries included -lCstd -lCrun -lm -lw -lcx -lc+
    -library=iostream+ - libraries included -liostream -lCstd -lCrun -lm -lw -lcx -lc+
    -library=iostream,no%Crun+ - libraries included -liostream -lCstd -lm -lw -lcx -lc+
    -library=stlport4+ - libraries included -lstlport4 -lCrun -lm -lw -lcx -lc+
    -library=iostream,no%Cstd+ - Invalid combination, some header files missing [[ *iostream, sstream* ]]
    When we try to make a new project, which of the following is recommended?
    #! - Use libCstd suppplied along with solaris package.
    When solaris makes a new release, is it always guaranteed that project is compatible with new libCstd ? (Is there a backward compatibility?)
    The STL components which can be used in the project are limited. i.e we can use only those that come along with libCstd.....right?
    Might not be compatible with other c++ compilers. ( Not compatible with g++ ) Right?
    #2 - Use libCStd along with libiostream
    Can we use STL (supported by libCstd ) + Classic-iostreams and still have the backward-compatibility?
    Compatible with other C++ compilers....provided care has been taken of the CC STL Specializations. ( Compatible with g++ ) Right?
    #3 - Use stlport4. Is it stable and backward-compatible ?
    We can exploit usage of STL to the maximum.
    Is it guranteed that the project (using -library=stlport4 ) will be backward compatible ?
    Can the SunStudio (ORACLE) organization gurantee that stlport will take care of the changes in the CPP standards ?
    i.e Is it guranteed that STLPORT and SUN-STUDIO packages will always be in sync?
    Among the above three which is preferred method to go ensuring stability and backward-compatibility.
    Thanks in advance.
    Cheers,
    Sreekar
    Edited by: 855323 on 20-Oct-2011 04:04
    Edited by: 855323 on 20-Oct-2011 04:04
    Edited by: 855323 on 20-Oct-2011 04:06

    In general, you don't need any options to use the C++ Standard Library (which includes what is sometimes loosely called the "STL"). Consider this toy program:
    // file vec.cc
    #include <vector>
    #include <iostream>
    int main()
        std::vector<int> vi(10);
        vi[1] = 1;
        std::cout << "vi[1]=" << vi[1] << '\n';
    }You can compile and run the program as either
    CC  vec.cc && a.out
    g++ vec.cc && a.outWith CC, by default you get the original libCstd. You use the -library option to select STLport or (on or selected versions of Solaris) Apache stdcxx instead. With g++, you just get the g++ library libstdc++, which should be suitable for all purposes.
    For a discussion of which library to select with CC, see this thread:
    Differnce between LibCstd and LibStlport
    The optional libiostream is provided to provide support for programs written for the very old version of iostreams that was provided with the original AT&T Cfront compiler in the 1980's and early 1990's. There is usually no reason to use this obsolete library with code written after 1998.
    The Solaris libCstd.so.1 (and libCrun.so.1) is always compatible with various releases of Studio, with one caveat: Each Studio release specifies the minimum patch level of Solaris libraries that is required to run programs created by the compiler. Any newer version of the library is guaranteed to be compatible. Thus, it is always safe to update the library, and an update might be required when using binaries created by a newer compiler.
    A version of the STLport library ships with the compiler. C++ binaries created by an older compiler that link to libstlport.so.1 should still work when linked into a program created by a newer compiler. Use of the static libstlport.a is generally not safe when mixing binary code from different compiler releases.
    Binaries created by Studio CC in default mode are not compatible with binaries created by g++. Even if you can get a program to link, which is doubtful, the program is not likely to run correctly.
    Studio CC does provide a g++ compatibility mode as follows:
    On supported versions of Linux with Studio 12.2 (C++ 5.11).
    On Solaris/x86 and supported versions of Linux with Studio 12.3 (C++ 5.12).
    In this mode, CC uses the g++ headers and the g++ runtime libraries.
    Refer to the -compat=g option in the C++ Users Guide for details.
    We plan to support the new C++ Standard, C++11, in a future compiler release. Because the ABI (binary interface) used by the current compilers is not adequate to support all the new features in C++11, we expect binaries built in C++11 mode to be incompatible with binaries created by earlier compilers. None of the existing C++ support libraries will be used in C++11 mode. A new library that provides full C++11 support will be used instead. We expect the new compiler to continue to provide the current C++03 mode as an option, being source and binary compatible with our earlier compilers.
    Edited by: Steve_Clamage on Oct 20, 2011 10:00 AM
    Edited by: Steve_Clamage on Oct 20, 2011 1:29 PM

  • Help Needed regarding the Header Information

    Hi,
    I am doing a File to IDOC Scenario for CREMDM. The problem I am Facing is that the Basic type is as CREMDM but it should be CREMAS. I am invoking the Function Module IDOC_INPUT_CREDITOR_MDM and I have made a 'Z' out of that. I have also Used a Custom Process Code to link with this Z Function Module, but it is giving me the Error that " Wrong Function Module Called up". In this Z Function Module I have also checked the Exception of "WRONG FUNCTION CALLED".
    <b>Can someone tell me the details of how I can know from where the Header Information is being populated and how i.e. the EDI_DC part.</b>
    I did the same thing (i.e. made a Z Function Module and a Z Process Code for DEBMDM) and it is working. In case of the CREMDM scenario, there is a check in the Function Module which checks the IDOCtype and it is giving an error there, whereas in the Header it is coming as CREMAS04 but the Function Module is Giving me an Error.
    <b>  Can someone Suggest me how I can go about a file to IDOC Scenario for CREMDM and which Function Module i need to Invoke.</b>
      Thanking in anticipation.
    Warm Regards
    Somnath

    Hi,
    Since this is file to idoc scenrio,the header inforamtion will be populated with the information provided in the mapping part i.e,it will be dependent on the fields mapped during the message mapping in XI .
        so the edc_dc control record parameters should be populated with the parameters mapped during the messsage mapping,depending on the file parameters or the constant defined during mapping.
    and in your case if the message type is CREMDM then the basic type has to be CREMDM04,which u hav to chk with the xi ppl who performed the mapping.since it is mapped to CREMAS04 u r getting a error in function module.so try changing basic type to CREMDM04.
    regards
    jithesh

  • Instant Message client - server communication

    Hi,
    I am writing an instant message application that has central server and many connected clients. When one client writes a message to the server, the server echoes the message to all concerned clients
    My server is a servlet, running on a J2EE web server. My client should run on Windows operating system and communicate with the WIN32 API.
    My problem is:
    The server is written in JAVA and my client should use the WIN32 API (in order to add its icon to the Windows tray for instance). How should I perform the client - server communication? What protocol/technology should I use? Should I write my client in C++ and from the server open a socket and perform HTTP requests? It looks too low level to me and not the �right� approach. Does it make sense to write my client in java and let it use JNI? And if yes, what is the preferred way of client � server communication?
    Is there any good reference I can use?
    Thanks

    The both alternates you are thinking over are fine. But the later one may cause some performance and memory issues.
    If you want to go with the first alternate, I suggest you to develope your owen server using ServerSocket and use your own protocol for communication between client and server over the sockets. Because using HTTP protocol will slow down your entire application. It adds overhead because each request passes through the servlet container.

  • About the communication issues in the client-server program

    About the communication issues in the client-server program
    Hi, I have some questions about the communication issues in a java project, which is basically the client and server architecture. In brief, the client, written in java, can be deployed anywhere, and in the following part, assume it is in the LAN (Local Area Network) which is connnected to the internet through the firewall and/or proxy, and the server, written in
    java too, simply provides the listening service on a port in a remote machine. And assume the server is connected to the internet directly so that the scenario can be simple to focus on the core questions.
    My questions are as follows:
    1 About the relationship between the communication port and protocol
    Generally, protocols at the application level like HTTP, FTP have their own default port, e.g., HTTP is corresponding to 80,
    FTP is to 25. But it is NOT necessary for the web server to provide the HTTP listening service at port 80, right? E.g, Tomcat provides the HTTP listening service at 8080. So it means the default relationship between the application protocl and their port is some routine, which is not necessary to follow, right?
    2 Assume a LAN connected to the internet through a proxy, which only allows HTTP protocol, then questions are:
    2.1 Does the proxy recognize the HTTP request from the client by the port number (carried in the request string)? For example, when the server provides the HTTP listening service at 80, then the request from the client will include the port number 80, then the proxy will parse such info and decide if or not the request can be out.
    2.2 Does the proxy recognize the HTTP request from the client by protocol (carried in the request string)? For example, the protocol used in the communicatin should be included in the request, then the proxy can parse it to make the decision.
    3 In java programm, if using the HTTP protcol, then on the client: the corresponding API is java.net.URLConnection, right?
    If using the TCP protocol directly, then on the client:the corresponding API is java.net.Socket, right? In both cases, the server side use the same API, java.net.ServerSocket?
    Is it correct to say that the communication by Socket is faster than URLConnection?
    4 Take MSN messenger for example, which protocol does it use? Since proxy configure is only the possible option, so I guess generally the TCP protocol is used directly so that the better perfomrance can be achieved, right?
    5 Given 3 computers within the same LAN, can the client, proxy, server environment above be correctly simulated? If so, can
    you recommend me some typical proxy program so that I can install it to configure such an enviroment to perform some test?
    6 I guess there should be some software to find out which port number a given program/process is going through to connect to
    the remote machine, and which port number a given program/process is listening on? Also, what protocl is used in the given
    communication.
    7 Finally, regarding each of the above questions, it will be highly appreciated that if you can recommed some references,
    tutorials, books etc. In summary, what I care about is how to enable the java client behind the proxy and firewall to
    communicate with the remote server without problems, so if you know some good tutorials plz let me know and thx in advance!
    Finally, thanks for your attention so such long questions =).

    FTP is to 25. But it is NOT necessary for the web
    server to provide the HTTP listening service at port
    80, right? E.g, Tomcat provides the HTTP listening
    service at 8080. So it means the default relationship
    between the application protocl and their port is
    some routine, which is not necessary to follow,
    right?Not sure what you're saying here.
    There must be a server listening on some port. The client must know what port that is. If you open the connection using the Socket class, you'll explicitly specify the port. If you use some higher level class like URLConnection or something in the commons Net package, there's probably a default port that will be used if you don't explicitly specify another.
    There's no way for the client to know that the HTTP request will go to port 80 instead of port 8080. If you think the the client contacts the server without explicitly naming a port, and then asks the server "get me your HTTP server", and the port is determined from that, you're mistaken.
    Not sure if you're thinking that, but it sounded like you might be.
    2 Assume a LAN connected to the internet through
    a proxy, which only allows HTTP protocol, then
    questions are:
    2.1 Does the proxy recognize the HTTP request
    from the client by the port number (carried in the
    request string)? For example, when the server
    provides the HTTP listening service at 80, then the
    request from the client will include the port number
    80, then the proxy will parse such info and decide if
    or not the request can be out. I'm not sure, but I think most proxies and firewalls are configured by ports. I thought I'd heard of more sophisticated, higher-level ones that could understand the content to some degree, but I don't know anything about those.
    3 In java programm, if using the HTTP protcol,
    then on the client: the corresponding API is
    java.net.URLConnection, right?That's one way.
    You might want to look into this:
    http://jakarta.apache.org/commons/httpclient/
    If using the TCP protocol directly, then on the
    client:the corresponding API is java.net.Socket,
    right? In both cases, the server side use the same
    API, java.net.ServerSocket? A Java client will user Socket, and a Java server will use ServerSocket and Socket.
    Is it correct to say that the communication by Socket
    is faster than URLConnection?Probably not.

  • Help needed regarding getting jnlp

    Hi all,
    we need help regading java web start. We are downloadng some set of jar files to the client side using JNLP. With these jar files jnlp launches a swing base application in the client side and interacts with server application depoyed in WebSphere. In order to launch this application IBM Jre is needed in the client side. But IBM Jre can not install in non IBM meachines. So, we planing to make jar file of Jre and download it along with the rest of the jar files. After that we want to install in some directory in the client meachine and use that JRE to launch application. Now we are couple of problems with this approach.
    1) To extract the Jre from the jar file we need the path, where these jars are downloaded.Even though we know the path "C:\Documents and Settings\Administrator\Application Data\IBM\Java\Deployment\cache" we can't hard code this, because user may change this location. The extraction program of this jar file in the client side is in one of the jar file that is downloaded. But here in the it is not able to recongnize relative path. So what we need is, is there any api to get this location of this path.
    2)Second, In order to launch the application with downloaded Jre we need to set the classpath for jars that are downlaoded with Jnlp. But after downloading these jar files to the client side they are renamed(prefixed with RM and RT). Now, how to set the classpath to these jar files.
    Here instead of JNLP if we use applet our problem will be solved. But we can't use applet because of client requirements.
    Anybody, please try to suggest me some thing with this problem.
    thanks,

    You might want to try posting your question to the Grid Control Forum.
    Enterprise Manager

  • Cannot initialize SecurID client-server communications

    Hi!
    I've installed RSA/Ace Server on a machine where iPortal is running too. The path to ace server's config files is /opt/ace/data. We've configured SecurID Server Identifier Name as "Server000". We don't really know what this means, so we didn't change it.
    We've also followed the troubleshooting guide found in iPortal's Admin docs (telnet the config and helper's ports), and mimmic the portal procedures. However we get exactly the same error: cannot initialize client-server communications.
    We've also installed 2 Unix agents on 2 differente IP's. What kind of agents must be configured for authentication to work ?
    What can be causing this ?

    I've experience to connect the ace server with portal server. The configuration is very simple and I think most of the setting in your portal is correct. One thing you should make sure is to config the portal server machine as a client to the ace server and it work. (In your case, it is same machine).
    Clive Chan

  • What Specific Firewall Rules are Needed for the DPM Server?

    Hello,
    We want to confirm which firewall ports need to be opened on the DPM server (not protected servers) for all DPM processes, so that we can set these rules in group policy. Below are what we
    think are the needed rules. Note that we have rules for both new DPM 2012 installs and upgrades from DPM 2010 to 2012, since these use different program paths.
    Rule Name
    Program Path
    Protocol
    Local Port
    DPM 2012 DCOM Port
    Any
    TCP
    135
    DPM 2012 AM Port
    Any
    TCP
    6075
    DPM 2012 RTM Agent Coordinator
    C:\Windows\Microsoft Data Protection Manager\DPM\ProtectionAgents\AC\4.0.1908.0\dpmac.exe
    Any
    Any
    DPM 2012 SP1 Agent Coordinator
    C:\Windows\Microsoft Data Protection Manager\DPM\ProtectionAgents\AC\4.1.3313.0\dpmac.exe
    Any
    Any
    DPM 2012 R2 Agent Coordinator
    C:\Windows\Microsoft Data Protection Manager\DPM\ProtectionAgents\AC\4.2.1205.0\dpmac.exe
    Any
    Any
    DPM 2012 AM Service Host (New Install
    %ProgramFiles%\Microsoft System Center 2012\DPM\DPM\bin\AMSvcHost.exe
    Any
    Any
    DPM 2012 AM Service Host (Upgrade Install)
    %ProgramFiles%\Microsoft DPM\DPM\bin\AMSvcHost.exe
    Any
    Any
    DPM 2012 DPM AM Service (New Install)
    %ProgramFiles%\Microsoft System Center 2012\DPM\DPM\bin\DPMAMService.exe
    Any
    Any
    DPM 2012 DPM AM Service (Upgrade Install)
    %ProgramFiles%\Microsoft DPM\DPM\bin\DPMAMService.exe
    Any
    Any
    DPM 2012 MSDPM (New Install)
    %ProgramFiles%\Microsoft System Center 2012\DPM\DPM\bin\msdpm.exe
    Any
    Any
    DPM 2012 MSDPM (Upgrade Install)
    %ProgramFiles%\Microsoft DPM\DPM\bin\msdpm.exe
    Any
    Any
    DPM 2012 DPMRA (New Install)
    %ProgramFiles%\Microsoft System Center 2012\DPM\DPM\bin\DPMRA.exe
    Any
    Any
    DPM 2012 DPMRA (Upgrade Install)
    %ProgramFiles%\Microsoft DPM\DPM\bin\DPMRA.exe
    Any
    Any
    Questions:
    Are any of these rules not needed?
    We know the Agent Coordinator rules are needed on protected servers. Are they also needed on the DPM server (including if we use secondary DPM servers)?
    The DPM Configuring Firewalls TechNet page says DCOM uses TCP 135 and the RPC Dynamic ports. Does that mean we also need a rule that opens all TCP RPC Dynamic ports for
    any program? Or is this not necessary since we have rules for msdpm.exe and dpmra.exe? Reference:
    http://technet.microsoft.com/en-us/library/hh757794
    What other rules may be missing, if any?
    Note that we do not include rules for ports 53 (DNS), 88 (Kerberos), 389 (LDAP), 137-139 & 445 (NetBIOS) because we already open these ports in other group policy objects.
    Also, the below forums post says two exceptions for SQL Server are needed on the DPM server to allow the Remote Administrator console to work. Is there any documentation in the DPM TechNet site on these rules?
    http://social.technet.microsoft.com/Forums/en-US/aa88fd00-6836-46d3-8a93-edb487109118/dpm-2012-remote-administration?forum=dataprotectionmanager
    Thanks,
    -Taylorbox

    Does anyone have any comments on this post? We would especially appreciate some input from Microsoft reps to help us ensure we're setting up the correct firewall rules.
    Thanks,
    -Taylorbox

  • Can I get information regarding the client browser using JSP

    can I get information regarding the client browser using JSP. like.. name, screen resolutions, font type, screen width and height of the browser etc.,
    if possible then please give me the samples..
    thanks,

    can I get information regarding the client browser using JSP. like.. name, screen resolutions, font type, screen width and height of the browser etc.,
    if possible then please give me the samples..
    thanks,

  • 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-43cc3b44

    I 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.

  • Help with Client/Server communication

    Im working on a project for university, and one aspect of it is downloading files from a remote computer.
    The majority of my project so far has been using RMI only, for browsing the remote computer, deleting files, renaming files, creating new directories and searching for files. All of this is done via a GUI client, with a server running on the server machine.
    Ive now reached the part where I'll need to implement the downloading of files. I want the user to select a file from within the GUI and click download, and get it off the server.
    I dont need any help with event handlers or getting the contents of the remote computer or anything of that sort.
    Consider when I have the name of the file that I want to download from the client.
    Im having trouble understanding how exactly its going to work. Ive seen examples of file transfer programs where the user types in the name of the file in the command line which they want to download. But my implementation will differ.
    Every time the user clicks the button, I have to send to the server the name of a different file which will need to be downloaded.
    I imagine in the event handler for the Download button I'll be creating a new socket and Streams for the download of the file that the user wants. But how am I to send to the client a dynamic file name each time when the user tries to download a different file?
    I am a bit new at this, and Ive been searching on the forums for examples and Ive run through them, but I think my situation is a bit different.
    Also, will RMI play any part in this? Or will it purely be just Socket and Streams?
    I'll also develop an Upload button, but I imagine once I get the Download one going, the Upload one should be much harder.
    Any ideas and help would be appreciated.

    Hi
    I'm no RMI expert... and I did not understand your question very well....
    I think you should do this procedure:
    you should send a request for the file from the client to the server . then a new connection between the two machines should be made which will be used to send the file.
    by using UDP you will achive it quite nicely...
    //socket - is your TCP socket  you already use on the client...
    //out - socket's output stream
    byte [] b=new String("File HelloWorld.java").getBytes();
    // you should use a different way for using this rather than using strings...
    out.write(b);
    DatagramSocket DS=new DatagramSocket(port);
    DS.recieve(packet); //the data is written into the packet...on the server side you should...
    //socket - is your TCP socket  you already use on the server...
    //in - socket's input stream
    byte [] b=new byte[256];
    out.read(b);
    /*Here you check what file you need to send to the client*/
    DatagramSocket DS=new DatagramSocket(server_port);
    byte [] data=//you should read the file and translate it into bytes and build a packet with them
    DS.send(packet); //the data is in the packet...This way the server sends the required file to the client .....
    I hope it will help, otherwise try being clearier so I could help you...
    SIJP

  • Help needed Regarding Project Server - 2013 Workflow

    Hi All,
    I am new to Project server 2013 Workflow, hence please help me regarding this. Pardon me if this question is too trivial. 
    I have created a project type associated with a workflow and my workflow is as follows :
    So I am not doing anything here, I am just testing the workflow as mentioned by technet site : http://technet.microsoft.com/en-us/library/dn458865(v=office.15).aspx
    But it is mentioned that, after a minute or 2, the workflow state will change, also they have mentioned to press the Submit button.
    But in my case, the workflow is not moving to next stage [It just says 'The workflow is still processing - which never changes after hours] or I am getting the submit button (Submit button is disabled on the ribbon). Below is the state of my workflow :
    PS : I have made the user added to Portfolio managers group as well. But still I am having this same issue. 
    The Workflow manager is installed properly, and it is working fine in case of List workflow. I am facing the issue only wrt Site workflow for Project server 2013.
    Please help me to solve this issue.
    Thanks,
    shanky

    Hi Kiran,
    I am now facing issue while assigning a task to a person in the workflow.
    I am having a person named say 'John' , who is included in Project Manager as well as Portfolio Manager.
    And I am using a workflow as :
    Stage : Conceptual
    Assign a task to John (Task outcome to Variable: Outcome5 | Task ID to Variable: TaskID3 )
    Transition to stage
    Go to Approval
    But this is again giving issue as :
    Workflow Internal status : Cancelled
    Details: System.ApplicationException: HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have
    permission to perform this action or access this resource."}}}
    PS : I have used the same Sharepoint admin account for 'Account Name' in ‘User Profile Sync' , Is this causing the issue? Please let me know.
    Thanks,
    Shanky

Maybe you are looking for

  • Can we compare file contents of two files in the Application server?

    Hi, A file is generated daily to the application server. and i need to compare the generated file to the file generated on the previous day and prepare a report. Can we compare file contents of two generated files present in the Application server? I

  • GUI Development Paradigm

    Hi everybody! I'm quite new in ALBPM and I have some questions about it, especially about user interfaces. I've been developing JSP aplications (using MVC frameworks) for a long time, and I can't figure out how does it fit in the ALBPM world. What's

  • HT1349 i deleted bonjour by mistake, how do i repair this

    how do i repair my itunes,, i deleted bonjour and now it wont let me download newer version,,, or fix old....

  • MacBook Air 13" Command Key Backlight

    I recently purchased a Mid-2011 13" MacBook Air.  I "love it", but it has a curious anomaly with the backlight behind the left Command Key.  The right Command Key shows three little backlight segments underneath as you tilt the keyboard up and look u

  • WORKORDER_UPDATE BADI Issue

    Dear all, We have a rather strange and a very high priority problem while using the BADI WORKORDER_UPDATE for creation of Maintenance orders. We have added some bespoke code into the method BEFORE_UPDATE of the BADI WORKORDER_UPDATE and expect it to