Search Results

Search found 1410 results on 57 pages for 'chat'.

Page 11/57 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Make a server for a chat

    - by Sebastian
    Hello, I would like to make a server for a chat and I wonder whether a server must, for example, connect to MySQL whenever a client enter to a room to check if he is moderator or banned from this room. Is it necessary that I use MySQL to update the number of connected clients whenever a client go to another room(to display the number of connected clients on a web page)?

    Read the article

  • Making skype like token field for adding users to a chat

    - by Miraaj
    Hi all, In Mac, in skype when we add users to an existing chat, by clicking '+' button on top, a beak like window appears carrying a token field like control. When an user types some name in it and a match is found then a list appears carrying user icon , status icon and his/her name. Also the width of dynamic list is same as beak window. Can any one suggest some way to create similar control? Thanks in advance, Miraaj

    Read the article

  • Chat client with GWT

    - by user284016
    What would be the best way to create a JS chat client with GWT? The bit that I'm having trouble with is the persistence and transfer of the messages. Should I store the messages in a DB and check the db for new messages? Is there a much better way to do this?

    Read the article

  • CSS absolute DIV causing other absolute DIV problems

    - by Tim
    Hello, I have implemented a chat script which requires an absolutely positioned DIV to be wrapped around the pages content. This is to ensure the chat windows stay at the bottom. The problem is that because of the absolute positioning of this main wrapper, all other absolutely positioned elements (eg. Jquery Auto-completes, datepicker's etc) now scroll up and down with the page. Here is an example of the HTML: <body> <div id="main_container"> <div id="content">Elements like Jquery Autocompletes, Datepickers with absolute positioned elements in here</div> </div> The DIV "main_container" style looks like this: #main_container { width:100%; background-color:#ffffff; /* DO NOT REMOVE THIS; or you'll have issue w/ the scrollbar, when the mouse pointer is on a white space */ overflow-x: hidden; overflow-y: scroll; height:100%; /* this will make sure that the height will extend at the bottom */ position:absolute; /* container div must be absolute, for our fixed bar to work */ } I hope there is a simple fix as the chat script is too good to get rid of. Thanks, Tim

    Read the article

  • software to allow a friend to look on your screen

    - by acidzombie24
    I want a friend of mine to review my code. I have a mic built into my laptop but i can use another software for voice chat. So i would like to have him to either view my screen (taking control might be fine) or show me his screen so he can talk about a specific piece of code. What software is good for this? We both think about security so an MS product (netmeeting? if that still exist on normal msn live installs) or an open source would be preferred. Should be free.

    Read the article

  • Using Off-The-Record and Trillian Astra together

    - by h4rrydog
    Does anyone know how to use Off-the-Record (OTR) with Trillian Astra? I've found the OTR for Trillian plugin here: http://trillianotr.kittyfox.net/ For the most part, it works and I can use OTR for chats with other people who initiate them or with people whose fingerprints I have. But I cannot initiate one myself to a user for whom I don't have a fingerprint. Other users have referred to using the OTR icon/menu to initiate an OTR chat, but there is no OTR icon or menu in the conversations window. I think this plugin was developed for a previous version of Trillian and not Astra (4.2). Anyone have any ideas on how to make this work? Thanks in advance!

    Read the article

  • jQuery works in FF but not in Safari

    - by Hristo
    I have some event handlers that work in FF and not in Safari. Simply put, I have a list of friends, some hard-coded, some pulled in from a database. Clicking on a buddy opens a chat window... this is much like the Facebook chat system. So in Firefox, everything works normally and as expected. In Safari, clicking on buddies that are hard-coded works fine, but clicking on buddies that are pulled in from the database doesn't pull up the chat window. <script type="text/javascript" src="js/jQuery.js"></script> <script type="text/javascript" src="js/chat.js"></script> <script type="text/javascript" src="js/ChatBar.js"></script> <script type="text/javascript" src="js/settings.js"></script> <script type="text/javascript"> var chat = new Chat(); var from = <?php echo "'" .$_SESSION['userid'] . "'"; ?>; chat.getUsers(<?php echo "'" .$_SESSION['userid'] . "'"; ?>); </script> So I load all my buddies with chat.getUsers. That function is: // get list of friends function getBuddyList(userName) { userNameID = userName; $.ajax({ type: "GET", url: "buddyList.php", data: { 'userName': userName, 'current': numOfUsers }, dataType: "json", cache: false, success: function(data) { if (numOfUsers != data.numOfUsers) { numOfUsers = data.numOfUsers; var list = "<li><span>Agents</span></li>"; for (var i = 0; i < data.friendlist.length; i++) { list += "<li><a class=\"buddy\" href=\"#\"><img alt=\"\" src=\"images/chat-thumb.gif\">"+ data.friendlist[i] +"</a></li>"; } $('#friend-list ul').append($(list)); } setTimeout('getBuddyList(userNameID)', 1000); } }); } buddyList.php just pulls in the Users from the database and returns an array with the user names. So the jQuery for clicking a buddy is: // click on buddy in #friends-panel $('#friends-panel a.buddy').click(function() { alert("Loaded"); // close #friends-panel $('.subpanel').hide(); $('#friends-panel a.chat').removeClass('active'); // if a chat window is already active, close it and deactivate $('#mainpanel li[class="active-buddy-tab"] div').not('#chat-box').removeAttr('id'); $('#mainpanel li[class="active-buddy-tab"]').removeClass('active-buddy-tab').addClass('buddy-tab'); // create active buddy chat window $('#mainpanel').append('<li class="active-buddy-tab"><a class="buddy-tab" href="#"></a><div id="chat-window"><h3><p id="to"></p></h3></div></li>'); // create name and close/minimize buttons $('.active-buddy-tab div h3 p#to').text($(this).text()); $('.active-buddy-tab div h3').append('<span class="close"> X </span><span class="minimize"> &ndash; </span>'); $('.active-buddy-tab').append('<span class="close"> X </span>'); // create chat area $('.active-buddy-tab div').append('<div id="chat-box"></div><form id="chat-message"><textarea id="message" maxlength="100"></textarea></form>'); // put curser in chat window $('.active-buddy-tab #message').focus(); // create a chat relationship return false; }); ... and the basic structure of the HTML is: <div id="footpanel"> <ul id="mainpanel"> <li id="friends-panel"> <a href="#" class="chat">Friends (<strong>18</strong>) </a> <div id="friend-list" class="subpanel"> <h3><span> &ndash; </span>Friends Online</h3> <ul> <li><span>Family Members</span></li> <!-- Hard coded buddies --> <li><a href="#" class="buddy"><img src="images/chat-thumb.gif" alt="" /> Your Friend 1</a></li> <li><a href="#" class="buddy"><img src="images/chat-thumb.gif" alt="" /> Your Friend </a></li> <!-- buddies will be added in dynamically here --> </ul> </div> </li> </ul> </div> I'm not too sure where to begin solving this issue. I thought it might be a rendering bug or something with the DOM but I've been staring at this code all day and I'm stuck. Any ideas on why it works in FF and not in Safari? btw... I'm testing on Snow Leopard. Thanks, Hristo

    Read the article

  • non blocking client server chat application in java using nio

    - by Amith
    I built a simple chat application using nio channels. I am very much new to networking as well as threads. This application is for communicating with server (Server / Client chat application). My problem is that multiple clients are not supported by the server. How do I solve this problem? What's the bug in my code? public class Clientcore extends Thread { SelectionKey selkey=null; Selector sckt_manager=null; public void coreClient() { System.out.println("please enter the text"); BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); SocketChannel sc = null; try { sc = SocketChannel.open(); sc.configureBlocking(false); sc.connect(new InetSocketAddress(8888)); int i=0; while (!sc.finishConnect()) { } for(int ii=0;ii>-22;ii++) { System.out.println("Enter the text"); String HELLO_REQUEST =stdin.readLine().toString(); if(HELLO_REQUEST.equalsIgnoreCase("end")) { break; } System.out.println("Sending a request to HelloServer"); ByteBuffer buffer = ByteBuffer.wrap(HELLO_REQUEST.getBytes()); sc.write(buffer); } } catch (IOException e) { e.printStackTrace(); } finally { if (sc != null) { try { sc.close(); } catch (Exception e) { e.printStackTrace(); } } } } public void run() { try { coreClient(); } catch(Exception ej) { ej.printStackTrace(); }}} public class ServerCore extends Thread { SelectionKey selkey=null; Selector sckt_manager=null; public void run() { try { coreServer(); } catch(Exception ej) { ej.printStackTrace(); } } private void coreServer() { try { ServerSocketChannel ssc = ServerSocketChannel.open(); try { ssc.socket().bind(new InetSocketAddress(8888)); while (true) { sckt_manager=SelectorProvider.provider().openSelector(); ssc.configureBlocking(false); SocketChannel sc = ssc.accept(); register_server(ssc,SelectionKey.OP_ACCEPT); if (sc == null) { } else { System.out.println("Received an incoming connection from " + sc.socket().getRemoteSocketAddress()); printRequest(sc); System.err.println("testing 1"); String HELLO_REPLY = "Sample Display"; ByteBuffer buffer = ByteBuffer.wrap(HELLO_REPLY.getBytes()); System.err.println("testing 2"); sc.write(buffer); System.err.println("testing 3"); sc.close(); }}} catch (IOException e) { e.printStackTrace(); } finally { if (ssc != null) { try { ssc.close(); } catch (IOException e) { e.printStackTrace(); } } } } catch(Exception E) { System.out.println("Ex in servCORE "+E); } } private static void printRequest(SocketChannel sc) throws IOException { ReadableByteChannel rbc = Channels.newChannel(sc.socket().getInputStream()); WritableByteChannel wbc = Channels.newChannel(System.out); ByteBuffer b = ByteBuffer.allocate(1024); // read 1024 bytes while (rbc.read(b) != -1) { b.flip(); while (b.hasRemaining()) { wbc.write(b); System.out.println(); } b.clear(); } } public void register_server(ServerSocketChannel ssc,int selectionkey_ops)throws Exception { ssc.register(sckt_manager,selectionkey_ops); }} public class HelloClient { public void coreClientChat() { Clientcore t=new Clientcore(); new Thread(t).start(); } public static void main(String[] args)throws Exception { HelloClient cl= new HelloClient(); cl.coreClientChat(); }} public class HelloServer { public void coreServerChat() { ServerCore t=new ServerCore(); new Thread(t).start(); } public static void main(String[] args) { HelloServer st= new HelloServer(); st.coreServerChat(); }}

    Read the article

  • Talk on multiple IRC channels at once?

    - by TwoPixelGrid
    I seem to remember, back in '91 or so, that the console-based IRCII implemention on the Solaris box that first got me on the net would let me /Join multiple channels on a given network such that, as new channels were joined, they would start scrolling to the single console view. Let's call it the 'interleaved conversation' chat paradigm. Am I rembering this correctly? More importantly, is there a modern way of doing this in any of the GUI-based clients? I'm surprised this isn't a common desire/feature because I think it would greatly improve the experience, especially on channels with high SNR. For example, If I'm working on a project I may connect to Freenode and join : #Qt,#OpenGL,#C++. As it is now, with mIRC,Xchat, I have to manually flip between pages just to see whats being said and to reply. What I envision would go more like this (using only 2 channels for simplicity) /join #QT #OpenGL < [QT] QtChannelUser: Hello TwoPixelGrid. < [OpenGL] OpenGLChannelUser: Hi there TwoPixelGrid. @QT: Hi QtChannelUser @OpenGL: Hello againOpenGLChannelUser And this message is going out to all my channels. Do I have to write a new client or is this already out there?

    Read the article

  • Java JTextPane JScrollPane Display Issue

    - by ikurtz
    The following class implements a chatGUI. When it runs okay the screen looks like this: Fine ChatGUI The problem is very often when i enter text of large length ie. 50 - 100 chars the gui goes crazy. the chat history box shrinks as shown in this image. Any ideas regarding what is causing this? Thank you. package Sartre.Connect4; import javax.swing.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.text.StyledDocument; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.BadLocationException; import java.io.BufferedOutputStream; import javax.swing.text.html.HTMLEditorKit; import java.io.FileOutputStream; import java.io.IOException; import java.io.FileNotFoundException; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.JFileChooser; /** * Chat form class * @author iAmjad */ public class ChatGUI extends JDialog implements ActionListener { /** * Used to hold chat history data */ private JTextPane textPaneHistory = new JTextPane(); /** * provides scrolling to chat history pane */ private JScrollPane scrollPaneHistory = new JScrollPane(textPaneHistory); /** * used to input local message to chat history */ private JTextPane textPaneHome = new JTextPane(); /** * Provides scrolling to local chat pane */ private JScrollPane scrollPaneHomeText = new JScrollPane(textPaneHome); /** * JLabel acting as a statusbar */ private JLabel statusBar = new JLabel("Ready"); /** * Button to clear chat history pane */ private JButton JBClear = new JButton("Clear"); /** * Button to save chat history pane */ private JButton JBSave = new JButton("Save"); /** * Holds contentPane */ private Container containerPane; /** * Layout GridBagLayout manager */ private GridBagLayout gridBagLayout = new GridBagLayout(); /** * GridBagConstraints */ private GridBagConstraints constraints = new GridBagConstraints(); /** * Constructor for ChatGUI */ public ChatGUI(){ setTitle("Chat"); // set up dialog icon URL url = getClass().getResource("Resources/SartreIcon.jpg"); ImageIcon imageIcon = new ImageIcon(url); Image image = imageIcon.getImage(); this.setIconImage(image); this.setAlwaysOnTop(true); setLocationRelativeTo(this.getParent()); //////////////// End icon and placement ///////////////////////// // Get pane and set layout manager containerPane = getContentPane(); containerPane.setLayout(gridBagLayout); ///////////////////////////////////////////////////////////// //////////////// Begin Chat History ////////////////////////////// textPaneHistory.setToolTipText("Chat History Window"); textPaneHistory.setEditable(false); textPaneHistory.setPreferredSize(new Dimension(350,250)); scrollPaneHistory.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneHistory.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // fill Chat History GridBagConstraints constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 10; constraints.gridheight = 10; constraints.weightx = 100; constraints.weighty = 100; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(10,10,10,10); constraints.ipadx = 0; constraints.ipady = 0; gridBagLayout.setConstraints(scrollPaneHistory, constraints); // add to the pane containerPane.add(scrollPaneHistory); /////////////////////////////// End Chat History /////////////////////// ///////////////////////// Begin Home Chat ////////////////////////////// textPaneHome.setToolTipText("Home Chat Message Window"); textPaneHome.setPreferredSize(new Dimension(200,50)); textPaneHome.addKeyListener(new MyKeyAdapter()); scrollPaneHomeText.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneHomeText.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // fill Chat History GridBagConstraints constraints.gridx = 0; constraints.gridy = 10; constraints.gridwidth = 6; constraints.gridheight = 1; constraints.weightx = 100; constraints.weighty = 100; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(10,10,10,10); constraints.ipadx = 0; constraints.ipady = 0; gridBagLayout.setConstraints(scrollPaneHomeText, constraints); // add to the pane containerPane.add(scrollPaneHomeText); ////////////////////////// End Home Chat ///////////////////////// ///////////////////////Begin Clear Chat History //////////////////////// JBClear.setToolTipText("Clear Chat History"); // fill Chat History GridBagConstraints constraints.gridx = 6; constraints.gridy = 10; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weightx = 100; constraints.weighty = 100; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(10,10,10,10); constraints.ipadx = 0; constraints.ipady = 0; gridBagLayout.setConstraints(JBClear, constraints); JBClear.addActionListener(this); // add to the pane containerPane.add(JBClear); ///////////////// End Clear Chat History //////////////////////// /////////////// Begin Save Chat History ////////////////////////// JBSave.setToolTipText("Save Chat History"); constraints.gridx = 8; constraints.gridy = 10; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weightx = 100; constraints.weighty = 100; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(10,10,10,10); constraints.ipadx = 0; constraints.ipady = 0; gridBagLayout.setConstraints(JBSave, constraints); JBSave.addActionListener(this); // add to the pane containerPane.add(JBSave); ///////////////////// End Save Chat History ///////////////////// /////////////////// Begin Status Bar ///////////////////////////// constraints.gridx = 0; constraints.gridy = 11; constraints.gridwidth = 10; constraints.gridheight = 1; constraints.weightx = 100; constraints.weighty = 50; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0,10,5,0); constraints.ipadx = 0; constraints.ipady = 0; gridBagLayout.setConstraints(statusBar, constraints); // add to the pane containerPane.add(statusBar); ////////////// End Status Bar //////////////////////////// // set resizable to false this.setResizable(false); // pack the GUI pack(); } /** * Deals with necessary menu click events * @param event */ public void actionPerformed(ActionEvent event) { Object source = event.getSource(); // Process Clear button event if (source == JBClear){ textPaneHistory.setText(null); statusBar.setText("Chat History Cleared"); } // Process Save button event if (source == JBSave){ // process only if there is data in history pane if (textPaneHistory.getText().length() > 0){ // process location where to save the chat history file JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); chooser.setAcceptAllFileFilterUsed(false); FileNameExtensionFilter filter = new FileNameExtensionFilter("HTML Documents", "htm", "html"); chooser.setFileFilter(filter); int option = chooser.showSaveDialog(ChatGUI.this); if (option == JFileChooser.APPROVE_OPTION) { // Set up document to be parsed as HTML StyledDocument doc = (StyledDocument)textPaneHistory.getDocument(); HTMLEditorKit kit = new HTMLEditorKit(); BufferedOutputStream out; try { // add final file name and extension String filePath = chooser.getSelectedFile().getAbsoluteFile() + ".html"; out = new BufferedOutputStream(new FileOutputStream(filePath)); // write out the HTML document kit.write(out, doc, doc.getStartPosition().getOffset(), doc.getLength()); } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(ChatGUI.this, "Application will now close. \n A restart may cure the error!\n\n" + e.getMessage(), "Fatal Error", JOptionPane.WARNING_MESSAGE, null); System.exit(2); } catch (IOException e){ JOptionPane.showMessageDialog(ChatGUI.this, "Application will now close. \n A restart may cure the error!\n\n" + e.getMessage(), "Fatal Error", JOptionPane.WARNING_MESSAGE, null); System.exit(3); } catch (BadLocationException e){ JOptionPane.showMessageDialog(ChatGUI.this, "Application will now close. \n A restart may cure the error!\n\n" + e.getMessage(), "Fatal Error", JOptionPane.WARNING_MESSAGE, null); System.exit(4); } statusBar.setText("Chat History Saved"); } } } } /** * Process return key for sending the message */ private class MyKeyAdapter extends KeyAdapter { @Override @SuppressWarnings("static-access") public void keyPressed(KeyEvent ke) { DateTime dateTime = new DateTime(); String nowdateTime = dateTime.getDateTime(); int kc = ke.getKeyCode(); if (kc == ke.VK_ENTER) { try { // Process only if there is data if (textPaneHome.getText().length() > 0){ // Add message origin formatting StyledDocument doc = (StyledDocument)textPaneHistory.getDocument(); Style style = doc.addStyle("HomeStyle", null); StyleConstants.setBold(style, true); String home = "Home [" + nowdateTime + "]: "; doc.insertString(doc.getLength(), home, style); StyleConstants.setBold(style, false); doc.insertString(doc.getLength(), textPaneHome.getText() + "\n", style); // update caret location textPaneHistory.setCaretPosition(doc.getLength()); textPaneHome.setText(null); statusBar.setText("Message Sent"); } } catch (BadLocationException e) { JOptionPane.showMessageDialog(ChatGUI.this, "Application will now close. \n A restart may cure the error!\n\n" + e.getMessage(), "Fatal Error", JOptionPane.WARNING_MESSAGE, null); System.exit(1); } ke.consume(); } } } }

    Read the article

  • WPF (irc) chat log control

    - by user408952
    I'm trying to learn WPF and was thinking about creating a simple IRC client. The most complicated part is to create the chat log. I want it to look more or less like the one in mIRC: or irssi: The important parts are that the text should be selectable, lines should wrap and it should be able to handle quite large logs. The alternatives that I can come up with are: StackPanel inside a ScrollViewer where each line is a row ListView, since that seems more suitable for dynamic content/data binding. Create an own control that does the rendering on its own. Is there any WPF guru out there that has some ideas on which direction to take and where to start?

    Read the article

  • MongoDB Schema Design - Real-time Chat

    - by Nick
    I'm starting a project which I think will be particularly suited to MongoDB due to the speed and scalability it affords. The module I'm currently interested in is to do with real-time chat. If I was to do this in a traditional RDBMS I'd split it out into: Channel (A channel has many users) User (A user has one channel but many messages) Message (A message has a user) The the purpose of this use case, I'd like to assume that there will be typically 5 channels active at one time, each handling at most 5 messages per second. Specific queries that need to be fast: Fetch new messages (based on an bookmark, time stamp maybe, or an incrementing counter?) Post a message to a channel Verify that a user can post in a channel Bearing in mind that the document limit with MongoDB is 4mb, how would you go about designing the schema? What would yours look like? Are there any gotchas I should watch out for?

    Read the article

  • chat website in jsp/servlet

    - by akshay
    I want to devlelop a chat website using JSP/Servlets and Tomcat. I have following questions: Can the website handle load (1000 people at one time) without slowing down? Will it cause the website to slow down? What is the ideal server configuration for this kind of website? Note that I don't have a huge budget to host. How can I implement server push? Will PHP or JSP be ideal for such website?

    Read the article

  • COMET chat application - IIS7 slows down over time

    - by Yaron
    I have built a chat application which uses this code to push messages to clients (web pages) and to monitor online users and their information. Basically, the code creates and manages a custom thread pool for maintaining the list of connected users & their state. The application was hosted on a shared hosting account (IIS6), and worked fine. After moving the site (ASP.Net App) to a dedicated virtual server it seems I have a problem where IIS7 gets slower and slower as time passes, and my only "solution" is to restart IIS. I am trying to look at the performance counters and have do idea on which one to look.

    Read the article

  • PHP / javascript live chat using too much bandwidth

    - by David
    So I am learning about javascript, so I am making a live chat system with PHP and javascript. I have it so the javascript refreshes the log (each message gets logged in a file on the server), and it refreshes every second. Im using firebug to monitor the resource usage, and I see under the net tab each times its updated, and the bytes add up really fast. I know I can change it to update less, but is there a way that when a user on the other end I'm talking to, when the send a message, it gets sent to the server, then an alert gets sent to me saying that the chatlog needs to update somehow. That way it only updates when the log is updated. let me know, thanks

    Read the article

  • Programmatically inviting contacts to Google Chat

    - by DBa
    Hello folks, I'm writing a sync application for Lotus Notes and Google (I know, there are some of them out there, but they are either not free or sync only calendar (or only contacts) and most of them cannot deal with local mailfiles). This works so far, but I have a problem when syncing contacts: under certain circustances, the contacts have to be deleted and recreated in Google. This causes them to disappear from the chat list in GMail and the people have to be re-invited manually. Is there any way to send these invites through the API? Thanks in advance DBa

    Read the article

  • User Drawn Controls: the MSN chat window

    - by Tommy
    I'm wondering about the famous MSN chat clients conversation windows! I'm sure there must be alot of different aspects but I'd like to focus on those little sliding panes. For instance where the pictures of the people in the conversation is displayed. When you click the collapse button the pictures dissapear and the panel gracefully slides in, and when you click it again to expand, it slides out and the pictures are smoothly faded in. How would one go about customly drawing a control in WinForms that had simmilar behaviour?

    Read the article

  • Chat Server with sockets in C

    - by Andrew
    I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server. I know I need one socket to bind() the server port to so I can accept incoming connections from clients, but in order to have two clients connected at the same time do I need to create a socket for each of these clients when I accept() or should I accept() a client and then fork() so I can have another client accept? I'm not worried about concurrent chatting yet, it's more of a ping-pong approach where the clients need to wait for a recv() after they send() before they can type a new message.

    Read the article

  • Help with chat server

    - by mithun1538
    I am designing a chat server in java. The communication is Http based and not socket based. In the client side I have an applet. In the server side I have a servlet. Applet: I create a new thread to listen for incoming messages(GET method). The main thread is used to send messages(POST messages). The partial code is : public void start() { System.out.println("Creating new thread"); Thread thread = new Thread(this); thread.start(); } private String getNewMessage() { System.out.println("Inside getNewMessage"); String msg = null; try { while(msg == null) { System.out.println("Trying to listen to servlet"); URL servlet = new URL(getCodeBase(), "NewServlet?mode=msg"); URLConnection con = servlet.openConnection(); con.setUseCaches(false); DataInputStream din = new DataInputStream(new BufferedInputStream(con.getInputStream())); msg = din.readUTF(); System.out.println("message read :" + msg); } } catch (Exception e) { e.printStackTrace(); } return msg + "\n"; } public void run() { System.out.println("Inside new thread"); while(true) { System.out.println("inside first while"); String newMsg = getNewMessage(); chatOutput.append(newMsg); System.out.println("Appended!!"); } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String message = chatInput.getText(); chatInput.setText(""); chatOutput.append(message + "\n"); try { System.out.println("Trying to send msg :" + message); URL url = new URL(getCodeBase(), "NewServlet"); URLConnection servletConnection = url.openConnection(); servletConnection.setDoInput(true); servletConnection.setDoOutput(true); servletConnection.setUseCaches(false); servletConnection.setRequestProperty("Content-Type", "application/octet-stream"); ObjectOutputStream out = new ObjectOutputStream(servletConnection.getOutputStream()); out.writeObject(message); out.flush(); out.close(); System.out.println("Message sent!"); } catch (Exception e) { e.printStackTrace(); } } This next code is from the servlet side. it uses the Observable interface to identify and send messages to clients. public class NewServlet extends HttpServlet { // getNextMessage() returns the next new message. // It blocks until there is one. public String getNextMessage() { // Create a message sink to wait for a new message from the // message source. System.out.println("inside getNextMessage"); return new MessageSink().getNextMessage(source);} @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Inside Doget"); response.setContentType("text/plain"); PrintWriter out = response.getWriter(); out.println(getNextMessage()); } // broadcastMessage() informs all currently listening clients that there // is a new message. Causes all calls to getNextMessage() to unblock. public void broadcastMessage(String message) { // Send the message to all the HTTP-connected clients by giving the // message to the message source source.sendMessage(message); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Inside DoPost"); try { ObjectInputStream din= new ObjectInputStream(request.getInputStream()); String message = (String)din.readObject(); System.out.println("received msg"); if (message != null) broadcastMessage(message); System.out.println("Called broadcast"); // Set the status code to indicate there will be no response response.setStatus(response.SC_NO_CONTENT); } catch (Exception e) { e.printStackTrace(); } } /** * Returns a short description of the servlet. * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; } MessageSource source = new MessageSource();} class MessageSource extends Observable { public void sendMessage(String message) { System.out.println("inside sendMsg"); setChanged(); notifyObservers(message); } } class MessageSink implements Observer { String message = null; // set by update() and read by getNextMessage() // Called by the message source when it gets a new message synchronized public void update(Observable o, Object arg) { // Get the new message message = (String)arg; // Wake up our waiting thread notify(); } // Gets the next message sent out from the message source synchronized public String getNextMessage(MessageSource source) { // Tell source we want to be told about new messages source.addObserver(this); System.out.println("AddedObserver"); // Wait until our update() method receives a message while (message == null) { try { wait(); } catch (Exception ignored) { } } // Tell source to stop telling us about new messages source.deleteObserver(this); // Now return the message we received // But first set the message instance variable to null // so update() and getNextMessage() can be called again. String messageCopy = message; message = null; System.out.println("Returning msg"); return messageCopy; } } As you can see I have included System.out.println("Some message"); in some places. this was just for debugging purposes. In java console, i get the following output: Creating new thread Inside new thread. inside first while. Inside getNewMessage. Trying to listen to servlet. In the servlet side, i get the following output in the tomcat logs: Inside Doget. inside getNextMessage. AddedObserver. After i type a message in the applet, and send it, I get the foll output in java console: Trying to send msg :you deR?? Message sent! But in servlet side, I dont get anything in the logs. I used the O'Reily Java Servlet Programming as reference(The observer interface comes from there). But I am not getting any chat communication between two clients. As can be understood from the logs, the POST method is not called. Any reason for this?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >