How does create a server with multiple Clients ?

Any people can lead me .
How does create a server with multiple Clients ?
Thanks

For a multithreaded server you will need a thread to listen and at least one thread per client. If the conversation is half duplex, one thread per client works very well, if it's full duplex you will find one thread to send and one to receive much easier to program.
I posted a Simple Socket Server that uses 1+2*clients threads.

Similar Messages

  • How to control one server with multiple clients via TCP/IP

    I am wanting to control a single server with multiple clients.  Only one client would be active at a time, so there would be no conflict.  I want to use TCP/IP.  So far, I have programmed a cluster that passes data back to the server with no problems.  The challenge come in when a second client is added to the mix.  I have't been able to figure out how to turn each client on and send the appropriate data and then turn it off so it doesn't keep sending the same data to the server. 
    Here are the things that I have considered and did some preliminary testing, but don't really know how to impliment:
    1.  Send a numeric on the front of the cluster packet that tells the server that data is on the way.
    2.  Send a boolean on the front of the cluster packet to somehow turn the server TCP/IP on.
    The problem I have found is that LabVIEW TCP/IP doesn't like to be turned on and off.  If it doesn't get the data it expects, it goes into a reset mode and that kills the response time.
    Any help?

    You should consider implementing a set of simple one-byte commands that can be sent back and forth between the Server and the Clients. You can base all of these ideas off the example in the Example Finder under Networking >> TCP and UDP called Multiple Connections - Server.
    You will have two loops in the server VI: one to wait for new connections, and one to send and receive data from the existing connections. For instance, after one of the clients connects, it can request control of the server to send data to it by sending the character "R" for request. Every time the send/receive loop of the Server executes, the first thing it can do is to check all the existing connections to see if any of the clients have sent a control request ("R"). If so, it will create a buffer (array) of control requests. This could be in the form of Connection IDs or indexes in the array for a particular Connection ID. Your choice.
    After the Server receives a request for contol, if it is not already under control by another client, then it can send a response to the first client on the control request list. For instance, the server could send the first client a "S" command for send. Note that after the clients send their control request, they should execute a TCP Read and wait indefinitely for the server to respond with the one-byte "S" command. Then, once the client in control is finished sending data to the server, it could send the character "X" telling the Server to release it from control.
    The example I mentioned above already does a similar thing. Note how when a client wants to disconnect, they send the letter "Q". You can see this in the Multiple Connections - Client VI. The Server then checks each individual connection to see if it's received this one-byte command, and if it has, it closes the connection to the client. This is what you would want to implement, but instead of having just one command, you'll have to distinguish between a few and build up a buffer of control requests.
    Finally, if a client does decide to disconnect in your application, they could send the command "Q" just like the example above. At this point, close the connection and remove that Connection ID from the array of connections. You will also have to handle the case that this client was in the request control waiting line when it disconnected, in which case you need to delete it from that array as well.
    This will definitely work for you, but it will take some work. Best of luck!
    Jarrod S.
    National Instruments

  • I need your expert opinion on how to create a map with multiple conditions.

    Hello.
    I need your expert opinion on how to create a map with multiple conditions.
    I have a procedure (which i cannot import or re-create in OWB due to the bug), so i am trying to create a map instead :-(
    How can i create a cursors within the map?
    My function creates table and cursor.
    Then it will have to check for duplicates in the tables (the one created and another table) - the criteria for finding duplicates is a number of fields.I then need to place few different conditions (if some attributes are not available) and it has to load cursor based on this conditions. The next step is to fetch the data into the cursor based on what attributes are missing.
    The next thing it will do is insert the data into table (if record doesn't exist), output the error in separate table is record is corrupted, or update the record with changed information.
    In short i need to re-create match / merge but with conditions, iterations etc 'built into' it.
    I can read up on available functions - it's just what would be the best options? and what would be the best approach to do so?
    In my function i use %rowtype - but cannot use it in owb - so what would be the alternative? i don't really want to create a lot of variables and then have a nightmare of maintaing it. are there any tips regarding this?
    having looked through Oracle dedupe - it's not really what i need because it is just DISTINCT.
    I would appreciate any help / advise on this.
    Thank you very much

    thanks a lot for your reply - i will look into this option :-)
    it is a bit more complicated now as i have to re-create the match / merge and then somehow 'tweak' it to achieve the result i need.
    At the moment i am looking to breakdown the package into smaller chunks 'functions' and try creating the map that way.
    Anyway, thank you very much for your suggestion.

  • How to create list items with multiple attachment files using rest api javascript

    In one of user form I am using javascript rest api to create a list item with multiple attachment files. So far I am able to create list item and once created uploading an attachment file. But this is two step process first create an item and then upload
    a file.
    It create an additional version of the item which is not desired. Also I am not able find a way to attach multiple files in a go. Following is the code I am using.
    createitem.executeAsync({
                    url: "/_api/web/lists/GetByTitle('UserForm')/items(1)/AttachmentFiles/add(FileName='" + aFile.name + "')",
                    method: "POST",
                    contentType: "application/json;odata=verbose",
                    headers: {
                        "Accept": "application/json;odata=verbose",
                        "X-RequestDigest": $("#__REQUESTDIGEST").val()
                    binaryStringRequestBody: true,
                    body: fileContent,
                    success: fnsuccess,
                    error: fnerror
    So somehow I need to combine item attributes along with attachment files in body: param. I visited https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_ListItem but no success.
    Appreciate any help.

    Thanks Mahesh for the reply and post you share it was useful.
    But this does not solve the core of the issue. You are uploading attachments after creation of item and multiple files are being attached in loop. This is kind of iterative update to an existing item with attachments. This will end up creating multiple versions. 
    What I am trying to achieve is to create an item along with multiple attachments in a go. No item updates further to attach a file.
    Please suggest how this can be done in one go. SharePoint does it when one creates an item with multiple attachment.
    Thanks for your reply.

  • How to create a table with multiple select on???

    Hi all,
            I am  new to webdynpro and my requirement is to create a  table with multiple selection on.I have to add abt 10 rows in the table but only 5 rows should be visible and moreover a verticalscroll should be available to view other rows.Can anybody explain me in detail how to do that.Please reply as if you are explaining  to a newcomer.Reply ASAP as i have to do it today.
                                                                           Thanxs

    Hi,
    1. Create a value node in your context name Table and set its cardinality to 0:n
    2. Create 2 value attributes within the Table node name value1 and value2
    3. Goto Outline view> Right click on TransparentUIContainer>Apply Template> Select Table>mark the node Table and it's attributes.
    you have created a table and binded its value to context
    Table UI properties
    4.Set Selection Mode to Multi
    5.Set Visible Row Count to 5
    6.ScrollableColCount to 5
    In your implemetaion, you can add values to table as follow:
    IPrivate<viewname>.ITableElement ele = wdContext.nodeTable().createTableElement();
    ele.setValue1(<value>);
    ele.setValue2(<value>);
    wdContext.nodeTable().addElement(ele);
    The above code will allow you to add elements to your table node.
    Regards,
    Murtuza

  • How to create Item Codes with multiple Item Description

    Hi,
    for one of my client, we need to create Item Codes with multiple Item Description.
    e.g.,
    Item Code - M00285
    Item Description 1 - Blue Paint
    Item Description 2 - Red Paint
    Is that possible in SAP Business One? If "Yes" kindly provide a solution. Else recommend an alternative method.
    Regards,
    Ammheya U. Naaik

    Ammheya,
    I just wanted to add that there is an Add-On that handles "Style, Color, Size" situations like yours.
    It allows you to define a "master" item, (Paint, for example) and then setup the various styles, colors and sizes it comes in. 
    This creates sub-items for each with the master in the ItemCode (Paint-Blue, Paint-Red, etc)
    It's called MatrixOne from Navigator.  You could find it on the partner portal with other Add-Ons.
    Hope thathelps,
    Brad Windecker

  • How to create linked server to multiple database on same server?

    Hi Experts
    I want to create linked server to multiple databases on the same server.
    I have 2 database servers (ServerA and ServerB) and want to create linked server on ServerB to link multiple databases on ServerA).
    I have admin right on ServerB.
    I don't have admin right on ServerA but have different accounts to access on each databases on ServerA.
    After I created one linked server object to a database, I cannot create another linked server object for another database as it has already used the server name which is ServerA.
    Please advise.
    Thanks.

    EXEC sp_addlinkedserver 'ServerADB1', '', 'SQLNCLI', 'ServerA', @catalog = 'DB1'
    EXEC sp_addlinkedserver 'ServerADB2', '', 'SQLNCLI', 'ServerA', @catalog = 'DB2'
    etc.
    Please look up the details for sp_addlinkedserver as I typed this from memory.
    I can certainly see a point in having one linked server per database, as then you don't have to hardcode the database name in the queries, and the linked-server definitions can be changed if the database name changes.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Server with multiple clients

    Hey all,
    I'm working on a simple Snake-like Java game - I'm done with the basics but I want to add in multiplayer capabilities. The game is not very complicated (hence I'm not posting on the game forum), but I have very little experience with network programming. I do know threading and GUI/Java2D stuff fairly well so that will be less of a problem. As far as the game itself goes, I want everybody to be able to see what everyone else is doing.
    As for the networking, basically what I want to do is as follows:
    1. One person runs the program and hits the "start server" button. This displays his IP and creates 7 new mini-screens for the other players. This also starts the server thread. (All of this is done already).
    2. The server thread will do a few things: 1) It will "listen" to any incoming connection requests and connect them to the server. 2) It will accept UDP datagram packets from the connected clients. It will process these and send the information to all the other clients. 3) It will monitor the state of the game and notify the clients about events like a player losing, the game ending, someone disconnecting.
    3. A client thread will be spawned in a program that connects to the server. The client thread will 1) send the server updated information on its state at set intervals. 2) Receive information from the server on the other clients at intervals.
    Obviously there is a whole lot more to consider, with special cases like someone disconnecting, the server crashing, etc. For right now, though, I just want to get the basics up.
    I've read through the Networking tutorials on this site, but I'm having trouble with a few design/technical issues even after looking through them.
    1. At a basic level, should I really be using UDP here? It seems like the better choice for fast games.
    2. Should I be using the MulticastSocket class? It seemed right initally but I got the impression that all clients I broadcast to would have to be in the same IP range, which is not the case here (I want Internet games to be possible).
    3. I'm not sure what I should be sending back and forth. From reading the tutorials my impression is that you can only send 256-long byte arrays in each packet. Does this mean I have to arbitrarily assign each byte in this array a meaning in the program? What if I have more than 256 bytes of info. to send?
    4. My basic idea was for the server to spawn and fork a thread for each of the connected clients, and for each client to spawn and fork a thread for all the other players in the game so that if someone crashes, disconnects, leaves, etc. only the thread responsible for displaying/updating their part stops. Is this the ideal setup? Is there a better way to handle this type of network model?
    5. The client/server need to be monitoring a few different things - should I just combine all this information into one big packet or separate it?
    Sorry for the long post, but I'm somewhat confused on what to do here.
    Thanks for the help!

    Thanks for the quick reply - I'll change around my design to use what you suggested. On a related note, how much slower, empirically, is TCP compared to UDP? For this application I need ping times between 300 and 500 ms for each of the clients.
    Also, regarding transferring information via TCP - since this is done with Buffered Read/writers can I transfer more back and forth? Basically I need to send the score (an int), as well as positional information for each player (could be as big as 50-100 ints). I'm worried that sending this volume of information is going to slow everything down quite a bit since not everyone has broadband. If I really have to be sending hundreds of ints a couple times a second to everyone, should I figure out a better way to do this? As long as each person's connection is at least 14k or so it should be ok, but it will also monopolize most of the bandwidth (at least with dialup connections).

  • How to create a ListDefinition with multiple ContentTypes

    Hi,
    i need to create a list definition with two contenttypes. When is use the Visual Studio SharePoint ListDefinition from ContentType, i am only able to add one contenttype to the list. But i have two contenttypes. I don't know how to add them to a ListDefinition
    (DocumentLibrary).
    This is my Contenttype:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field ID="{1D6C3BF2-5269-4892-B147-659A5EE36BED}" Name="MyChoiceField" DisplayName="MyChoiceField" Type="Choice" Group="MyBox" Hidden="False" Required="False">
    <CHOICES>
    <CHOICE>-/-</CHOICE>
    <CHOICE>Choice1</CHOICE>
    <CHOICE>Choice2</CHOICE>
    </CHOICES>
    </Field>
    <!-- Parent ContentType: Document (0x0101) -->
    <ContentType ID="0x010100d7d016b413b244e8a6a185cf8b0afd3b"
    Name="MyBox Document"
    Group="MyBox"
    Description=""
    Inherits="False"
    Version="0">
    <FieldRefs>
    <FieldRef ID="{1D6C3BF2-5269-4892-B147-659A5EE36BED}" />
    <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Hidden="TRUE" Required="FALSE" DisplayName="_hidden" />
    </FieldRefs>
    </ContentType>
    <!-- Parent ContentType: Folder (0x0120) -->
    <ContentType ID="0x012000cdce40c9703b4b5aa7a84044a040c005"
    Name="MyBox Folder"
    Group="MyBox"
    Description=""
    Inherits="False"
    Version="0">
    <FieldRefs>
    <FieldRef ID="{1D6C3BF2-5269-4892-B147-659A5EE36BED}" />
    </FieldRefs>
    </ContentType>
    </Elements>
    Is there a way to create a minimal schema.xml with these contenttypes manually or what are the steps to build a listdefinition with multiple contenttypes?
    Best Regards
    Bog
    Developers Field Notes | www.bog1.de

    You can define them in the schema.xml of list definition.
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="Something" Direction="$Resources:Direction;" Url="Something" BaseType="1" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
    <MetaData>
    <ContentTypes>
    <ContentTypeRef ID="0x0100707A19136D594D7784D9E30A5FBA58C1002D7898DEE60A4FDEBD3CD1EFAB442000" />
    <ContentTypeRef ID="0x0100707A19136D594D7784D9E30A5FBA58C1002D7898DEE60A4FDEBD3CD1EFAB4427A000678E9CDB185C4DCEAC41F865393A1234" />
    <ContentTypeRef ID="0x0100707A19136D594D7784D9E30A5FBA58C1002D7898DEE60A4FDEBD3CD1EFAB4427A0007A4D2F6526CA4D8F8B5AD2BD64C3A123" />
    </ContentTypes>
    <Fields> </Fields>
    <Views> </Views>  </MetaData>
    </List>
    --Cheers

  • How to create a dashboard with multiple prompts ?????

    Dear All,
    I need to design a dashboard with multiple prompts, which has been desined from webi.
    Ex: i have a prompts of year,sales manager and promotions has prompts in webi report.
    I am trying to create a dashboard on top of this webi report; i am also using live office.
    how can i design this dashboard with mutiple prompts.
    any doc's are links which is related to this topic will be a great help.
    Thanks in advance.
    Regards,
    Suman

    Dear Praveen,
    Thanks for your suggestion; i hope we need some third party tool for multiple selection.
    But i need to know which kind selectors i can use from the components for multiple selection.
    question 1:
    Ex:
    I have prompt for year;
    scenario 1: i need to filter the year by 2001,2002,2003.
    or
    scenario 2: need to filter the year by only one year 2001.
    question 2:
    I have created a dashboard on top of webi report; but i have filter for the year in from to value's.
    Ex:
    Year is from 2001 - 2009.
    when i am enabling this prompt in xcelsius i cannot see from and to option; how should i design this one.
    Regards,
    Suman

  • How to create sales return with multiple invoices

    Hi ,
    I am creating a sales order return with reference of billing document using FM SD_SALESDOCUMENT_CREATE, if i give one Billing document as a reference document it is creating document perfectly.
    But my Requirement is to create one Return sales order with multiple invoices.
    I tried to pass reference document no's in Item level , but it take first reference document number only , for that reference document only return is creating.
    Can you any one help me how to create this.
    Thanks in advance
    Swapna.

    Hello Venkat,
    As I know it is not possible to create a single return order for multiple invoices in the background.
    It is possible in the foreground by following the below steps.
    1) Goto VA01 --> enter the Sales order type and Sales area.
    2) Press F8 or click on create with reference, provide the first invoice.
    3) Now the main screen would appear, displaying line items from Invoice1.
    4) Without going back, again goto path, Sales document -> Create with reference
    5) Enter second invoice2. and the items from invoice2 will also appear in the Sales order line item.
    ------ Enter as many number of invoices by repeating the above step--------------------
    6) Press save, so one sales order is created for multiple invoices.
    Regards,
    Thanga

  • How to create Interactive PDF with multiple .mp4 videos– without lagging on playback?

    I'm creating a long document with no real effects-- just a "fade" transition from page to page-- and multiple videos. These videos are all formatted as .mp4s, and I have had no issues with the actual process of getting them embedded and playing back on export.
    My real issue is that the videos are all extremely laggy on playback. Since this is a presentation document, I'd like to know if there are any options for making the playback a bit smoother. Each video, by itself, plays with no issues. Would the combined filesize of all the videos be causing this? There are about eight 30-second videos and one 2-minute video, which makes the filesize quite large.
    Filesize is not an issue, so is there some way to completely embed the videos or create an external folder the PDF document can draw the videos from on playback...? Hopefully I won't be stuck with laggy videos.

    My suspicion is that computer setup has more to do it than anything. How much RAM, whether other apps are loaded, what kind of graphics chip, stuff like that.
    I don't know of a setting, though you can look at the Flash Player settings in Acrobat. There is certainly nothing in InDesign that would affect it.

  • How to access web server with SSH client

    I need to access my web server via SSH. I do not have clue how to go about. I have transmit for ftp but looks like I cannot use SSH with Tranmit.
    I guess I need to know:
    - What ssh client to I need to get?
    - If not detailed instruction provided How do I go about? I know I need the port # and my ip address and I have both of those but not sure what else I am to do.
    TIA for the help!

    Open up Terminal. It's in the Utilities folder.ssh -p <port#> <ipaddress> or, if you need to log on with a different user namessh -p <port#> <username>@<ipaddress>

  • How to create a group with multiple data fields

    Post Author: RichS
    CA Forum: Formula
    Using CR XI.  Using CSV input from ODBC text driver.  No problems here.
    There are 3 fields that I want the same group by action.  Is this possible?) 
    If any one of these 3 fields change I want some header information and column fieldnames to display.  The header information I only want displayed on the first page (on the change) and the column fieldnames to display on every page.  I have played around with things like "InRepeatedGroupHeader" and "report group header on each page".  I am not getting all the results that I am looking for though.
    I want report to look like:
    Page header stuff  (to display on every page)  This data consists of some fields that will have static data and will display on every page.  And it consists of 3 non-static fields that I want to group on. 
    Group header stuff that I only want displayed on the first page on a change from one of the 3 fields mentioned above.
    Column headings that I want displayed on every page.
    Details data
    Group footer stuff (details not important for this)
    I get the expected output (column headings displayed on every page, and group header stuff display on the first page on each group change) with one group field.  But I want the group change to happen for all 3 fields.
    It seems simple but I can't find a way to create a "group" so if "field1 or field2 or field3" change, I get the same "group by" action.  I just need to know how to get the expected action.
    I expect that I might have some terms mixed up and/or some important information that would aide you in helping me.  If that is the case please re-post and I will add any missing or mis-stated information.
    Thanks,

    Post Author: V361
    CA Forum: Formula
    I am slightly confused, but perhaps you can create a formula
    Then group on the formula.  If this is not what you want, could you post some sample data, with the desired results.

  • How to create the query with multiple node types

    Hi,
    I am having an issue in creating a query to search multiple node types.
    The requirement is to query documents/pages of the type dam:Asset and cq:Page present under a path.
    I tried the following code snippet with no luck .
    path=/content
    1_type=cq:Page
    2_type=dam:Asset
    property=jcr:content/metadata/@cq:tags
    property.1_value=<tag Name>
    I was able to write a query with single type. However i could not find any documents/ materials with multipe types as shown above.
    Thanks in advance.
    Regards
    Sudhi

    I don't think multiple type is possible. Instead use super type like nt:base that will cover both page and asset.
    Yogesh
    www.wemblog.com

Maybe you are looking for