Socket Based Server's Performance?

Now i am write a prototype of a Server, using Socket/ServerSocket to communicate.
The problem is that the performance is low:(
When the Server listens the Client Input Stream i use a loop forever to detect the Input Stream, this cause the usage rate of CPU is so high(80%~95%).
It is so expensive, and other Application runs Slow.
So any advise to me?
3ks.

Two choices, one using "standard" IO and one using the "nio" packages.
With standard IO - each connection from a client is spun into its own Thread. Each Thread blocks at the read. There is no "busy wait" loop; the main ServerSocket is blocked waiting for new connections, any existing connections are blocked on reads. When new data comes in, the appropriate Thread wakes up, does whatever it does, and goes back to reading.
The downside of this is that it doesn't scale to large numbers of simultaneous connections. Too many Threads will choke any machine (esp. when "too many" gets into the 1's or 10's of thousands...) With the "nio" packages, you can have one Thread handle many connections at one, by using select() and looking to see which ones have data ready.
Sounds like you need to bone up on server design, tho - this is a well-understood problem, and there's lots of writing about it out there. Google (or a good tech bookstore) is your friend!
Good luck

Similar Messages

  • Socket-based server skeleton controls

    I've been having a tough time coming up with a "nice" way to approximate the command-line functionality of apachectl for a server I'm working on in Java. I'd like to be able to issue command-line options like 'java myserver start' but can't really think of a good way of going about implementing this. I know how to read the command-line arguments just fine, and starting the server isn't a big issue, but doing anything else to it seems troublesome. I know I could just make a server.class that just runs and doesn't stop, then make a supporting app analogous to apachectl that actually sets a flag file or something to notify the original server class that it's time to change it's behaviour or stop, etc.. but is there any way to do it without using a support program to control? Can it all be worked into one single server class somehow?
    Any ideas would be appreciated. I've googled all over the net looking for any hints and examples, but everyone seems far more interested with just getting their servers started, but never worrying about how to issue a clean command-line shutdown or restart of them.

    The server uses a listner socket as a control port.
    On start up (using the 'start' option) the server tries to connect to the port using ServerSocket. If it fails then it exits (probably because the server is already running.)
    With the shut down option the server does nothing but send a 'shutdown' command to the port (connecting using a Socket not a SocketServer.) If it fails to connect it exits because the server isn't running.
    If a server receives a 'shutdown' command on the control port then it shuts itself down.

  • Socket Based Server/Client Program Help Needed

    Alright,
    I am making a Client/Server program.
    The idea is that, when I run the 'Server' part, it sits and listens for a connection from the Client.
    The Client writes a string to the socket, then the server, interprets the command.
    This is what I have so far.
    The Server:
    public static void main(String[] args) {
             String clientLine = null;
              Socket channel = new Socket();
              try {
                   mainWin window = new mainWin();
                   window.open();
              } catch (Exception e) {
                   e.printStackTrace();
             try{
                   ServerSocket server = new ServerSocket(8313);
                  BufferedReader reader = new BufferedReader(new InputStreamReader(channel.getInputStream()));
                 channel = server.accept();
                 clientLine = reader.readLine();
                 doCommand(clientLine);
                 reader.close();
                 channel.close();
                 server.close();
             catch(IOException ioe){
                  System.out.println("I/O Exception occurred while using the server");
         }The Client:
    public void sendCommand(String command){
              PrintStream socketWriter  = null;
              try{
                    Socket client = new Socket("127.0.0.1", 8313);
                    socketWriter = new PrintStream(client.getOutputStream());
                    socketWriter.println(command);
                    socketWriter.close();
                    client.close();
              }catch(UnknownHostException uhe){
              }catch(IOException ioe){
         }When I press the command button, it lags for a second, then does nothing.
    Does anyone see the problem?

    public static void main(String[] args) {
             String clientLine = null;
              Socket channel = new Socket(); //<-- This is connecting to where? nowhere, so initiate it to null instead.
              try {
                   mainWin window = new mainWin();
                   window.open();
              } catch (Exception e) {
                   e.printStackTrace();
             try{
                   ServerSocket server = new ServerSocket(8313);
                  BufferedReader reader = new BufferedReader(new InputStreamReader(channel.getInputStream())); //<-- Getting an input stream from nowhere?
                 channel = server.accept(); //<-- Perhaps you want to do this before you try to get the input stream from it?
                 clientLine = reader.readLine();
                 doCommand(clientLine);
                 reader.close();
                 channel.close();
                 server.close();
             catch(IOException ioe){
                  System.out.println("I/O Exception occurred while using the server");
         }

  • Client/server socket based application

    hi does anyone have example of client/server socket based application using Spring and Maven
    where application do the following
    Client sends a request with a path to any file on the server
    „h Server reads the file and responds back with the content
    „h Client outputs the content to the console
    am trying to follow this
    http://www2.sys-con.com/itsg/virtualcd/java/archives/0205/dibella/index.html
    http://syntx.io/a-client-server-application-using-socket-programming-in-java/
    am using java 6

    i have attempt code but i wht to do the following
    client/server socket based application that will read the content of a file and stream the content of the file to the client. The client must simply output the content of the file to the console using System.out. The client must be able to run in a standalone mode (non-network mode) or in a remote mode.
    Additionally the client must be designed in a way that i can print the output to a console but must be interchangeable where if requirements change i can persist the response to file or persist the response to a database.
    /* Server.java*/
    ///ifgetBoolen= true then...
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.sql.*;
    public class Server
        static String array[][];
        // STEP 1 a1  
        // Server socket
        ServerSocket listener;
        // STEP 1 a2 Client connection
        Socket client;
        ObjectInputStream in;
        ObjectOutputStream out;
        public void createConnection() throws IOException
                System.out.println("\nSERVER >>> Waiting for connection.....");
                client = listener.accept();
                String IPAddress = "" + client.getInetAddress();
                DisplayMessage("SERVER >>> Connected to " + IPAddress.substring(1,IPAddress.length()));
          public void runServer()
            // Start listening for client connections
            // STEP 2
            try
                listener = new ServerSocket(12345, 10);
                createConnection();
                  // STEP 3
    //              processConnection();
            catch(IOException ioe)
                DisplayMessage("SERVER >>> Error trying to listen: " + ioe.getMessage());
        private void closeConnection()
            DisplayMessage("SERVER >>> Terminating connections");
            try
                if(out != null && in != null)
                      out.close();
                    in.close();
                    client.close();                
            catch(IOException ioe)
                DisplayMessage("SERVER >>> Closing connections");
        public static void define2DArray(ResultSet RS, int Size)
            try
                ResultSetMetaData RMSD = RS.getMetaData();
                DisplayMessage("SERVER >>> Requested arraySize: " + Size);
                if (RS.next())
                    array = new String[Size][RMSD.getColumnCount()];
                    for (int Row = 0; Row < Size; Row++)
                        for (int Col = 0; Col < RMSD.getColumnCount(); Col++)
                            array[Row][Col] = new String();
                            array[Row][Col] = RS.getString(Col+1);
                            DisplayMessage(array[Row][Col] + " ");
                        RS.next();
                else
                    array = new String[1][1];
                    array[0][0] = "#No Records";
            catch (Exception e)
                DisplayMessage("SERVER >>> Error in defining a 2DArray: " + e.getMessage());  
        public static void DisplayMessage(final String IncomingSMS)
            System.out.println(IncomingSMS);
    //client
    * @author
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class ClientSystem
        static Socket server;
        static ObjectOutputStream out;
        static ObjectInputStream in;
        static String Response[][];
        static boolean IsConnected = false;
        static int Num = 0;
        public static void connectToServer() throws IOException
            server = new Socket("127.0.0.1", 12345);
    //        server = new Socket("000.00.98.00", 12345);
            String IPAddress = "" + server.getInetAddress();
            DisplayMessage("\nCLIENT >>> Connected to " + IPAddress.substring(1,IPAddress.length()));
        public static void getStreams() throws IOException
            out = new ObjectOutputStream(server.getOutputStream());
            out.flush();
              in = new ObjectInputStream(server.getInputStream());
              IsConnected = true;
              DisplayMessage("CLIENT >>> Got I/O streams");  
        public static void runClient()
            try
                connectToServer();
                getStreams();
                  DisplayMessage("CLIENT >>> Connection successfull....\n");
                  DisplayMessage("CLIENT >>> Want to talk to server");
            catch (IOException ioe)
                System.out.print("."+Num);
                Num++;
        public static void closeConnection()
            try
                out.close();
                in.close();
                server.close();  
            catch(IOException error)
                DisplayMessage("CLIENT >>> Could not close connections");
        public static void Start()
            System.out.print("\nCLIENT >>> Attempting connection.....");
            try
                IsConnected = false;
                while (IsConnected == false)
                    runClient();
                    if (IsConnected == false)
                        Thread.sleep(100);
            catch (Exception e)
                DisplayMessage("CLIENT >>> Attempting connection.....");
        public static String sendSMS(String sms)
            Response = new String[0][0];
            try
                DisplayMessage("CLIENT >>> " + sms);
                out.writeObject(sms);
                out.flush();
                Response = (String[][])in.readObject();
                DisplayMessage("CLIENT >>> Waiting for server to respond...");
                for (int Row = 0; Row < Response.length; Row++)
                    System.out.printf( "_SERVER >>> \t");
                    for (int Col = 0; Col < Response[Row].length; Col++)
                        //DisplayMessage( "_SERVER >>> " + Response[Row][Col] + " ");
                        System.out.printf( "%s\t", Response[Row][Col]);
                    System.out.println();
                DisplayMessage("CLIENT >>> Query processed successfully....\n");
            catch(ClassNotFoundException cnfe)
                DisplayMessage("CLIENT >>> Class not found for casting received object");
            catch(IOException ioe)
                reConnect();          
            catch (Exception sqle)
                DisplayMessage("CLIENT >>> Error sending query ??? " + sqle.getMessage());
            return "transmission successfull";
        public static void reConnect()
            try
                DisplayMessage("CLIENT >>> Connection was lost. Trying to reconnect...");
                closeConnection();
                Thread.sleep(100);
                IsConnected = false;
                while (IsConnected == false)
                    runClient();
                    Thread.sleep(200);
            catch (Exception e)
                DisplayMessage("CLIENT >>> Error trying to Re-Connect...");
        public static void DisplayMessage(final String IncomingSms)
            System.out.println(IncomingSms);
        System.out.printf("Isms: %s", IncomingSms);  ///naah.
        public static String[][] getResponse()
            return Response;
        public static String getResponse(int row, int col)
            return Response[row][col];
    how can i do below using above code
    The program must be able to work in a non-networked mode. In this mode, the server and client must run in the same VM and must perform no networking, must not use loopback networking i.e: no “localhost” or “127.0.0.1”, and must not involve the serialization of any objects when communicating between the client and server components.
    The operating mode is selected using the single command line argument that is permitted.
    imust use a socket connection and define a protocol. networking must be entirely bypassed in the non-network mode.

  • TCP Provider: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

    Hi All,
    We have snapshot replication . Job is failing in between due to below error.
    Error messages:
    The process could not connect to Subscriber 'XX:SD'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20084)
    Get help: http://help/MSSQL_REPL20084
    TCP Provider: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. (Source: MSSQLServer, Error number: 10055)
    Get help: http://help/10055
    A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information
    see SQL Server Books Online. (Source: MSSQLServer, Error number: 10055)
    Get help: http://help/10055
    Login timeout expired (Source: MSSQLServer, Error number: HYT00)
    Get help: http://help/HYT00
    Please suggest

    Hi Khushi,
    According to your description, your snapshot replication job fails and you come across the error related to TCP Provider. Based on my research, the issue could occur as the following two situations.
    1. OS runs out of memory for TCP buffers. When people use the two switch: the /PAE switch in the c:\boot.ini file and the /3gb switch in the boot.ini file. If the applications require many OS resources, such as by opening many TCP connections, this can cause
    the OS to run out of memory for resources like TCP buffers.
    2.OS runs out of available TCP “ephemeral” ports. When the client machine is opening many TCP connections and is running Windows Server 2003, Windows XP, or any earlier version of Windows, it may run out of TCP “ephemeral” ports.
    To work around the issue, please follow the two solutions as below.
    1.Remove the /3gb switch from c:\boot.ini. The root problem in this case is memory pressure on the OS, so removing the /3gb switch will give more memory to the OS and will alleviate this problem.
    2.Make more ephemeral ports available following the steps in the article:
    http://support.microsoft.com/kb/196271
    For more information about the process, please refer to the article:
    http://blogs.msdn.com/b/sql_protocols/archive/2009/03/09/understanding-the-error-an-operation-on-a-socket-could-not-be-performed-because-the-system-lacked-sufficient-buffer-space-or-because-a-queue-was-full.aspx
    Regards,
    Michelle Li

  • Can ARD 3 be used for users who want to remote into a windows based server?

    I have a couple users at the company I work at who will need to be able to remote into our Windows Server. These users all have Macs and will have to go about remoting in differently. I have done some research on Apple Remote Desktop but i am unsure if it fits my users needs. If I have someone download and install this software on a mac, will they then be able to remote into a windows based server using an IP address? that is my goal in mind  could get some help on this one I'd appreciate it.
    Thanks,
    - Rich

    I'm referring to what windows can do via Remote Desktop connection.
    You open up the RDC dialog box, enter an external IP address (if working remotely) or a server name if working internally and connect right to the machine. Ideally i want my users to be able to log into our terminal server and be able to use a program remotely. they will have to log on to this server with company credentials. Basically from a mac, connecting up to a Windows Server and remotely logging into it to perform tasks.
    I'm really just trying to find an easy way to do this for my user's with MAC's since it is not as straightforward as in windows. I cannot test anything out at home since i do not own a mac so i come to the community to see if you guys have had the same kind of situation before.
    ARD was the first peice of software that looked like it might fit my needs but if it doesn't is there anything out there? is it for free or for a cost? any help is greatly appreciated. Thanks.
    - Rich

  • Non Java Based Server

    Is there a possibility that a MIDlet can communicate with a Server which is not written using Java? If yes then how? I thought about the following solution:
    Develop a MIDlet which uses Sockets(as sockets are Java's implementaation of TCP/IP) to connect to specific URL on a specific port. Develop a Server in some other language like C++ may be which listen on that particular port. As the protocol will be TCP/IP so both can communicate easily.
    What do you say about this?

    With sockets you send raw data back and forth, over a protocol like TCP/IP for example. And http is a higher level protocol, where on top you need to conform to the messaging protocol, like request methods (GET,POST), http headers, etc. (complete into on the http protocol can be found at http://www.ietf.org/rfc/rfc2616.txt).
    The main difference though is that with http you are limited to a request-response style communication, where the client (your MIDlet) requests information from the server and the server can only respond to your client's requests and can't actively send data (without receiving a request first), whereas with sockets both server and client can send and receive data. This means that, for example, an online game based on http would need to poll the server for updates constantly to see if the other player has made a move, opening a new connection every time. A socket based game would only open two connections, one to send data and one to receive (maybe even only one send-receive connection), and use these connections throughout the game sending and receiving from both client and server as you wish. So sockets would be preferable except that in MIDP they are not officially supported so for compatibility your better off (and might have no choice even) with http.
    To implement a C++ server you would need to make a server that constantly listens to a specified port (the default http port is 80), and parses the requests it receives and replies appropiately (with a valid http response). But there are many available web-servers that can already do the listening and parsing for you (Apache, IIS, etc.) and you only need to then implement the construction of the response so I don't think it would be the way to go.
    shmoove

  • Building a simple J2ME chat client (for own J2SE-based server) Threading Qs

    Hi!
    I am making my own simple chat / messenger service to use between a couple of friends over GPRS.
    On the server side i have made a multi threaded TCP server that opens a new thread for each connecting client and stores these socket connections in a hashtable for access to send data between each thread.
    So when a client logs on to the server, the server sends a printwriter message to all other clients informing them of what client connected, and the clients can put the username in its out-database. then the clients can send messages to each others using a simple, self build protocol.
    All connection between clients/server happens over a simple printwriter on in/out streams.
    Problem is: it works perfectly most of the time.... However, sometimes a message is mysteriously lost when transferred from the server to a client. Transfer from client to server works flawlessly. I am thinking that it might have something to do with the client side threading, or slow network transfer casuing a TCP read error.
    Client structure is as following:
    start-> Midlet class -> (press connect to server) -> new Client class (impl runnable) -> new thread(this) -> void run() sets up all connections and writers, waits in a while loop for messages from server and takes action according to message type. -> Button(send) uses output stream to send a message to server.
    Do anyone have any suggestions on what I must consider when making a client that will simultaniously be able to listen for data from server as well as send data to server over 1 socket and slow mobile connection without causing any trouble?
    More info can be provided if necessary.
    Thank you!

    Building a simple J2ME chat client (for own J2SE-based server)a. i would like to say that this is a bl00dy brilliant idea. i mean ~ its been done before but building one yourself is quite thrilling.
    b. are u using java 4 or java 5. ?
    sometimes a message is mysteriously lost when transferred from the server to a client. Transfer from client to server works flawlessly.are you using push registry to recieve incoming connections.
    i recommend using a StreamConnectionNotifier connection instead of just a socket connection. you could send your data (xml/plain text) just like a stream (tcp ofcourse). if you want to know how to use a StreamConnectionNotifier connection, here's how
    try{
    // listen at local port 789
    StreamConnectionNotifier notify = (StreamConnectionNotifier) Connector.open(“http://:789”);
    // infinite loop to get incoming connections
    for(;;)
    StreamConnection stream = notify.acceptandOpen();  // return a stream connection when a connection is made
    InputStrean mystream = stream.openInputStream();
    while(mystream!=-1)
    mystream.read();
    ....cheers

  • Error 58 The specified server cannot perform the requested operation

    Hello,
    I will try to explain the situation as brief as possible. Next to our current existing MDT environment (MDT2010 on Windows 2008 R2) we are no building a new system (MDT2013 on WIndows 2012 R2). We have multiple sites and the MDT deployment share is setup
    in DFRS share so every site is getting the same deployment information and replication is done automatically. This has been working firn for 3 years with the old system and also with the new environment it was working fine in our own subnet. But when after
    i have setup the remote MDT and WDS servers it is not working in these remote sites. The images are loading fine but for some reason the win PE is not connecting to the shares on the windows 2012 server in our site. When i manuualy connect from a remote win
    PE to our server i always get the error: system error 58 has occured. The specified server cannot perform the requested operation.
    I have been doing some troubleshooting and it seems i only got this issue when i connect from win PE 5.0 to a windows 2012 R2 server in a remote subnet.
    When i use win PE 5.0 and connect to a windows 2012 R2 share in the same subnet it connects fine. 
    When i use win PE 5.0 and connect to a windows 2008 R2 share in a remote subnet it connects fine
    When i use an older win PE and i connect to a windows 2012 R2 share in a remote subnet it connects fine
    When i use win PE 5.0 and connect to a windows 2012 R2 share in a remote subnet it does NOT connect and gives the above error
    The problem is that this problem also does not occure in Windows 7, after the machine was build by MDT and get into the OS i can connect without a problem to the windows 2012 R2 shares.
    Checking the event viewer on the 2012 R2 server that is hosting the shares i see that the following events are created:
    4624: An account was successfully logged on.
    Subject:
    Security ID:
    NULL SID
    Account Name:
    Account Domain:
    Logon ID:
    0x0
    Logon Type: 3
    Impersonation Level: Impersonation
    New Logon:
    Security ID:
    domain\username
    Account Name:
    username
    Account Domain: domain
    Logon ID:
    0x1F1FC0
    Logon GUID:
    {8e360e91-001b-c726-84a6-e7281a4bcac8}
    Process Information:
    Process ID:
    0x0
    Process Name:
    Network Information:
    Workstation Name:
    Source Network Address:
    x.x.x.x
    Source Port:
    60077
    Detailed Authentication Information:
    Logon Process:
    Kerberos
    Authentication Package:
    Kerberos
    Transited Services:
    Package Name (NTLM only):
    Key Length:
    0
    This event is generated when a logon session is created. It is generated on the computer that was accessed.
    The subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.
    The logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).
    The New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.
    The network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.
    The impersonation level field indicates the extent to which a process in the logon session can impersonate.
    The authentication information fields provide detailed information about this specific logon request.
    - Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.
    - Transited services indicate which intermediate services have participated in this logon request.
    - Package name indicates which sub-protocol was used among the NTLM protocols.
    - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.
    5140: 
    A network share object was accessed.
    Subject:
    Security ID:
    domain\username
    Account Name:
    username
    Account Domain: domain
    Logon ID:
    0x1F1FC0
    Network Information:
    Object Type:
    File
    Source Address:
    x.x.x.x
    Source Port:
    60077
    Share Information:
    Share Name:
    \\*\Captures
    Share Path:
    \??\D:\Captures
    Access Request Information:
    Access Mask:
    0x1
    Accesses:
    ReadData (or ListDirectory)
    4634: 
    An account was logged off.
    Subject:
    Security ID:
    domain\username
    Account Name:
    username
    Account Domain: domain
    Logon ID:
    0x1F1FC0
    Logon Type: 3
    This event is generated when a logon session is destroyed. It may be positively correlated with a logon event using the Logon ID value. Logon IDs are only unique between reboots on the same computer.
    Anyone an idea why this is happening?

    Hi,
    We can refer to the following blog for MDT troubleshooting:
    http://blogs.technet.com/b/askcore/archive/2012/05/08/mdt-2010-amp-2012-my-deployment-failed-what-and-where-are-logs-i-should-review.aspx
    Best Regards,
    Vincent Wu
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Is it possible for a mac to run across a Windows based server such as in a school, and still be able to access all networked folders? I have been told that macs can only read down a certain number of folders

    Is it possible to run a mac on a windows based server? We have a server based on Windows 7 in our school, and our techies are reluctant to let me buy a mac as they say macs can only read a number of folders deep, which would preclude me from accessing shared folders on our servers. Is this true, and is there a way round this? I would eventually like to get a suite of macs, but because all our resources are on the server, I have to be able to access them.
    Thanks for any help,
    Mike

    I have found that both Linux and Mac (unix) are capable of reading "deep" folders while win 32 will have issues, your it people are clearly wrong.  I run a network with both win/mac. And as long as the win servers/pc's that have shares are set to allow apple file sharing in their folder properties.   And the macs are set to allow smb there should absolutely no trouble with you accessing anything across the platforms, heck, from a Mac to a win pc on some occasions you don't even need to include a "domain" name to log on to, and you can create aliases and make your own shortcuts etc... So you don't have to manually connect each time you boot up etc... But that's all personal preferences I suppose.
    All I can tell you is that, I do it on a daily basis managing a small business. So your answer is yes you can.

  • Non-SysAdmins get error 18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.

    I have a SQL 2008 R2 system (10.50.4000) where I'm having problems connecting any user that is not a SysAdmin.  Example: I setup a new SQL Login to use Windows Authentication and grant that user db_datareader on the target database.  The user attempts
    to connect using Excel client or Access or SQL Management Studio and receives Error 18456.  The SQL Server Logs shows Error 18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    The strange part is that if I temporarily grant the user the sysadmin server role then the user can connect successfully and retrieve data.  But, if I take away that sysadmin server role then the user can no longer connect but again receives the Error
    18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    We've turned off UAC on the client machine to see if that was the problem, but no change.
    I have dropped and re-added the user's SQL Login (and the related database user login info).  No success.
    The Ring Buffers output shows:
    The Calling API Name: LookupAccountSidInternal
    API Name: LookupAccountSid
    Error Code: 0x534
    Thanks for any help.
    -Walt

    Yes, you understand correctly.  The user is logging onto a workstation (not the server) with a Windows Authenticated id.  The user is using either Excel or Access or SSMS and connecting to the server using a Windows Authenticated SQL Login account.
     If the account has sysadmin role (which is only for testing) then the connection is successful.  If I take away sysadmin role from the account then the connection is unsuccessful and the SQL Server Log shows Error
    18456 Severity 14 State 11 Login Failed for user _ Reason Token-based server access validation failed with an infrastructure error.
    (SQL Authentication is not an option here.  I must use Windows Authentication).
    Any other troubleshooting assistance you can offer would be appreciated.  Thanks.
    -Walt 

  • Token-based server access validation failed with an infrastructure error

    Hi
    We have a new Win 2008 Enterprise x64 server running SQL 2008
    When we try to connect to the server using Windows Authentication, from a user account which is a domain administrator, we get the following message:
    "Token-based server access validation failed with an infrastructure error"
    What needs to be configured here for this to work ?
    Thanks
    Bruce

    Hi,
    I am encountering the same error message but it is more around the login, this problem happens only on one server but it is fine on another three, my investigation show it is a ghost SID associated with AD user account
    Background
        1- An Active Directory (AD) account was created for a user [Domain\UserA]
        2- A SQL login was created for the account above and then granted access to a number of databases
        3- The AD account was renamed/modified to [Domain\UserB]
        At this stage the user would encounter an error when connecting to the server
        The sql log show this error message
        Error: 18456, Severity: 14, State: 11.
        Message
        Login failed for user 'domain\user'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors.     [CLIENT: xxx]
    Action on Server 1 SQL (the one with the problem)
        1- Dropped the user from the databases
        2- Re-Created the login from the windows account [Domain\UserB]
        3- Created the user in the respective databases
        But the user still unable to connect to the server
    Investigation
        On server 1, the SID of the user in SYSUSERS was Matching SYSLOGINS and matches with result of SUSER_SID(Domain\UserA)
        But it does not match the SID in the AD
        The rest of the servers all have the correct SIDs
        When I use SUSER_SNAME(Incorrect-Sid) and SUSER_SNAME(Correct-Sid) on this server they both return [Domain\UserB]
        The problematic server is always returning the incorrect SID when recreating the user login and when using SUSER_SID(Domain\UserA) as if it is cached somewhere.
    I can't specify the SID when creating the SQL login because it is using the Windows account
    Your ideas on how to fix this problem are much appreciated
    Regards,
    DGL

  • "The specified server cannot perform the requested operation" when rpc from server 2003 to Windows 7

    I am having problems where all my Windows 2003 servers cannot rpc to 2 of my Windows 7 workstations, error message is "The specified server cannot perform the requested operation".
    All the machines are in workgroup environment.
    Windows 7 workstations: desk1, desk2, desk3, desk4, desk5, desk6
    Windows 2003 servers: server1, server2, server3, server4, server5
    Windows 2008 server: server6
    From any Windows 7 workstation I can rpc to any other machines,
    \\desk1\d$, no problem
    From any Windows 2003 server I can rpc to all the machines exception desk4 and desk5, they give the "The specified server cannot perform the requested operation". However, desk4 and desk5 can rpc to any other machines (including the Windows 2003
    servers), no problem
    From Windows 2008 rpc to desk4 and desk5 also no problem.
    I also have no problem rpc between any of the Windows 2003 servers,
    \\server2\d$ from server3, no problem.
    I turned off the firewall at desk5 and desk4, just to try, but didn't help, same problem. This show firewall is not the cause of the problem.
    Desk4 and Desk5 used to run Windows 2012 for 1 year and recently I downgraded them Windows 7 Professional x64. When they were running as Windows 2012, those Windows 2003 servers have no problem rpc to desk5 and desk4.
    The issue is thus lying between desk4 and desk5 with Windows 2003 only\
    Any suggestions?
    Valuable skills are not learned, learned skills aren't valuable.

    Hi,
    I found a related thread and a hotfix for similar issue:
    Problems Accessing Administrative Shares Remotely - Windows cannot access \\Servername\ShareName
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/9807a799-bea3-46ad-92a5-732779135f98/problems-accessing-administrative-shares-remotely-windows-cannot-access-servernamesharename?forum=winserver8gen
    You cannot access an administrative share on a computer after you set the SrvsvcDefaultShareInfo registry entry to configure the default share permissions for a network share
    https://support.microsoft.com/kb/971277/en-us
    Also please check if it is caused by security program such as antivirus program. 
    If you have any feedback on our support, please send to [email protected]

  • FTP_CONNECT to Windows based server

    Hi Experts,
    I am using FM <b>'FTP_CONNECT'</b> to send a file from local pc to <b>Windows based server</b>.
    I am using the parameters: username, pwd, hostname, rfc destination (when I test the RFC destination SAPFTP in SM59, it connects OK)
    I connected to the HOSTNAME from <b>command prompt</b> and it connects OK with same parameters.
    But when we try to connect with FM <b>'FTP_CONNECT'</b>, it gives error:
    'User has no access authorization for computer HOSTNAME'.
    Please advise,
    Regards,
    FS

    Following is the code we have used and it is working without any problems..
    Password encryption
    data : v_password(20),
    v_key type i value 26101957,
    v_slen type i.
    --- ENCRYPT PASSWORD
    The password is entered by the user on the selection screen in the parameter p_pswd.
    clear v_password.
    set extended check off.
    v_password = p_pswd.
    translate v_password to lower case.
    v_slen = strlen( v_password ).
    call 'AB_RFC_X_SCRAMBLE_STRING'
    id 'SOURCE' field v_password
    id 'KEY' field v_key
    id 'SCR' field 'X'
    id 'DESTINATION' field v_password
    id 'DSTLEN' field v_slen.
    FTP Connect
    data v_hdl type i.
    call function 'FTP_CONNECT'
    exporting
    user = p_usrid (User id used to connect)
    password = v_password
    host = p_ip_add (IP of the server to be connected)
    rfc_destination = p_sapftp (value is normally SAPFTP or SAPFTPA)
    importing
    handle = v_hdl
    exceptions
    not_connected = 1
    others = 2.
    From your msg it looks that the FTP connection is not the problem.. The problem is with the permissions for the user, with which you are doing the ftp, has..
    This user does not have write permissions in the directory in which it is trying to write the file..
    Try doing the FTP manually.. If this works then the FTP Command u r using after the FTP Connect should also work..

  • Failed Logins - Token Based Server Access Validation Failed

    Hi All-
    I am trying to track down, well for lack of a better word (an annoyance).  I have a VM running a proprietary utility (VMware update manager) that connects to a remote SQL VM.  This connection is via a service account that from the surface has the
    appropriate permissions.  The setup and utility has been in and is working as it should.  However in our logs we are constantly seeing.
    SQL Event Viewer - Login failed for DOMAIN/REMOTESERVERNAME$ Reason: Token-based server access validation failed with an infrastructure error.  Check for previous errors [CLIENT: REMOTEIP OF REMOTESERVERNAME]
    Then in the SQL Logs I am seeing the same error and also - ERROR 18546, Severity 14, State 11
    I have read dozens of threads - pointing to UAC.  I have elevated SSMS via UAC and allowed it to run as administrator.  Also ran as admin, and reapplied the permissions to that service account, db_owner
    What I have read is about AD/user account.  However in this case I am seeing the remote server name, not service account.  Got me thinking a service is running as network or local system, and phoning home to SQL.  However everything I see
    is using the service account for that utility.  Also in the event viewer in the security portion for that same time, I see the login and log off as successful.  Could anyone try to point me in the right direction, without flat out adding the servername
    to the local SQL VM administrators group.
    Thank you in advance for any assistance.

    Rather than adding the machine account to the admin group, you could do:
      GRANT CONNECT TO [Domain\Remoteservername$]
    And then you could set up a logon trigger that captures information about the login. That would include app_name() as well as the Windows process id. This could help you track exactly which process that is knocking on the door.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • ABAP ROUTINE AT INFOPACKAGE FOR DATE RANGE

    hi all, I want to Schedule my infopackge with selection options  0DATE  infoobject with First date of current month( 01.02.2008)  to last date of current month ( 29.02.2008). this i have to get automatically bcoz i have to use this in process chain.

  • How to use GO_BLOCK in POST_CHANGE trigger?

    Hi All, I have a post_change trigger on a text item, I wanna change the background color (using visual attribute) of some items in another block according to the value of that text item mentioned. But when I put a value for the first time some backgr

  • MDX formula help

    The formula below works just fine but I want to use a UDA driven member in Member Range and need help. IIF( Count( Intersect( {MemberRange( [Jan],[Apr] )}, {[Time].CurrentMember} ) = 1, [Actual], [Forecast]) I tried with IIF( Count( Intersect( {Membe

  • N96 - Update and Format

    Hi is there a way to workaround the last option to format a phone after update? Last update the multimedia key was not working after update, whatever i did it not activate, so after formating it worked. But to install always all applications is terri

  • Interfaces, mixers & preamps

    Looking for some input concerning interfaces, mixers & preamps. Not real pleased with the acoustic guitar sound thru line in, haven't tried a mic yet but I think I would benefit from some type of interface. Need to be able to accommodate electric gui