达内生产实习报告qq聊天软件.doc_第1页
达内生产实习报告qq聊天软件.doc_第2页
达内生产实习报告qq聊天软件.doc_第3页
达内生产实习报告qq聊天软件.doc_第4页
达内生产实习报告qq聊天软件.doc_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

达内生产实习报告目 录1前言31.1 实习背景 312 实习环境2实习内容42. 1 实习过程423 主要成果 113总结123.1实习体会 123.2 其它意见 13学生实习鉴定141前言1.1 实习背景 由于学校课程要求加上专业限制,学校根据教学要求。组织我们于2010年7月2号至2010年7月4号参加生产实习。实习单位是达内科技有限公司。1.2 实习环境 在linux系统下面,使用EJAVALIPSE开发工具,使用java语言进行支持跨平台的即时通讯软件研发。在实习其间跟随项目经理进行了qq聊天通讯工具的设计,实习期间分别对qq的通讯原理,界面设计,通讯过程,进行了详细的分析与操作。 2实习内容2. 1 实习过程在实习期间跟随项目经理,在linux系统下面,使用EJAVALIPSE开发工具,使用java语言进行支持跨平台的即时通讯软件研发。我们主要进行了qq聊天通讯工具的设计,实习期间分别对qq的通讯原理,界面设计,通讯过程,进行了详细的分析。22 实习内容 第一天开学典礼及实习主要内容的介绍,Java语言的一些简单操作 第二天Java中的标识符,关键字,数据类型的简单介绍 If else,while,do while语句的使用 第三天通过写类 创建对象,面向对象的特征两军对站游戏 第四天图形界面开发与及时通讯系统项目概要设计及时通讯系统客户端界面设计第五天及时通讯系统客户端界面进一步设计面试技巧及职业生涯规划第六天完成及时通讯系统客户端界面的设计 程序一import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.OutputStream;import .Socket;import javax.swing.DefaultListModel;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.JTextField;public class Client extends JFrame implements ActionListener /northJPanel north = new JPanel();JMenuBar bar = new JMenuBar();JMenu m1 = new JMenu(conServer);JMenu m2 = new JMenu(about);JMenuItem conServer = new JMenuItem(conServer);JMenuItem disServer = new JMenuItem(disServer);JMenuItem exit = new JMenuItem(exit);JMenuItem about = new JMenuItem(aboutSoft);ImageIcon icon = new ImageIcon(Client.class.getResource(top.jpg);JLabel img = new JLabel(icon);/westJPanel west = new JPanel();ImageIcon icon2 = new ImageIcon(Client.class.getResource(left.jpg);JLabel img2 = new JLabel(icon2);DefaultListModel dlm = new DefaultListModel();JList userList = new JList(dlm);JScrollPane listPane = new JScrollPane(userList);/centerJPanel center = new JPanel();JTextArea showMsg = newJScrollPane showPane = new JScrollPane(showMsg);JPanel operPane = new JPanel();JLabel msg = new JLabel(please input:);JTextField msgInput = new JTextField(40);JButton send = new JButton(send);String name;Socket socket = null;ObjectOutputStream oos = null;public Client() init();initFrame(); public void init() /northconServer.addActionListener(this);disServer.addActionListener(this);exit.addActionListener(this);about.addActionListener(this);m1.add(conServer);m1.add(disServer);m1.add(exit);m2.add(about);bar.add(m1); bar.add(m2);BorderLayout bl = new BorderLayout();north.setLayout(bl);north.add(bar,BorderLayout.NORTH);north.add(img,BorderLayout.SOUTH);this.add(north,BorderLayout.NORTH);/westuserList.setBackground(Color.gray);Font f = new Font(隶书,Font.BOLD,23);userList.setFont(f);Dimension dim = new Dimension(150,340);listPane.setPreferredSize(dim);BorderLayout bl2 = new BorderLayout();west.setLayout(bl2);west.add(img2,BorderLayout.NORTH);west.add(listPane,BorderLayout.SOUTH);this.add(west,BorderLayout.WEST);/centersend.addActionListener(this);showMsg.setEditable(false);showMsg.setBackground(Color.green);FlowLayout fl3 = new FlowLayout(FlowLayout.LEFT);operPane.setLayout(fl3);showMsg.setFont(new Font(宋体,Font.BOLD,25);operPane.add(msg);operPane.add(msgInput);operPane.add(send);BorderLayout bl3 = new BorderLayout();center.setLayout(bl3);center.add(showPane,BorderLayout.NORTH);center.add(operPane,BorderLayout.SOUTH);this.add(center,BorderLayout.CENTER); public void initFrame()this.setLocation(200, 200);this.setResizable(false);this.setTitle(Welcome To XXXX);this.setSize(800, 600);this.setDefaultCloseOperation(EXIT_ON_CLOSE);this.setVisible(true); public static void main(String args) Client c = new Client();Overridepublic void actionPerformed(ActionEvent ae) String comm = ae.getActionCommand();if(comm.equals(send)String str = msgInput.getText();if(socket = null)JOptionPane.showMessageDialog(this, please connect server.);return ;if(str = null | str.trim().equals()JOptionPane.showMessageDialog(this, can not send null string);return ;Message msg = new Message();msg.msgType = chat;msg.content = str;msg.from = name;msgInput.setText();try oos.writeObject(msg);oos.flush(); catch (IOException e) else if(comm.equals(conServer)int cnt = 0;for(;)cnt+;String ip = JOptionPane.showInputDialog(this, please input server IP:);String port = JOptionPane.showInputDialog(this, please input server Port:);System.out.println(ip+ +port);trysocket = new Socket(ip,Integer.parseInt(port);System.out.println(socket);catch(Exception e)System.out.println(connect server ERROR!);JOptionPane.showMessageDialog(this, connect server ERROR!);if(cnt = 3 & socket = null)JOptionPane.showMessageDialog(this, sorry, input 3 times);System.exit(0);if(socket != null)break;name = JOptionPane.showInputDialog(this, please input your name:);new Thread()public void run()try while(true)ObjectInputStream ois = new ObjectInputStream(socket.getInputStream();Object obj = ois.readObject();Message msg = (Message)obj;String type = msg.msgType;if(type.equals(login)if(dlm.size() = 0)for(Object obj2 : msg.userList)dlm.addElement(obj2);elsedlm.addElement(msg.from);String str = msg.content;if(showMsg.getText() = null | showMsg.getText().trim().equals()showMsg.setText(str);elseshowMsg.setText(showMsg.getText()+n+str); catch (Exception e) .start();Message message = new Message();message.from = name;message.msgType = login;try OutputStream os = socket.getOutputStream();oos = new ObjectOutputStream(os);oos.writeObject(message);oos.flush(); catch (IOException e) this.setTitle(name+,welcome to chatroom);else if(comm.equals(disServer)System.out.println(dis Server);else if(comm.equals(aboutSoft)System.out.println(soft msg.);else if(comm.equals(exit)System.exit(0);程序三import java.io.*;import java.util.*;public class Message implements Serializable public String from;public String to;public String msgType;public Date sendTime;public String content;public List userList = new ArrayList();import java.io.IOException;import java.io.InputStream;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import .ServerSocket;import .Socket;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.List;public class Server private ServerSocket ss;private List sockets = new ArrayList();private List names = new ArrayList();public Server() try /33ss = new ServerSocket(9999); catch (IOException e) public static void main(String args) new Server().go();private void go() while (true) try / 等待用户连接Socket socket = ss.accept();sockets.add(socket);System.out.println(socket.getRemoteSocketAddress();final Socket s = socket;new Thread() public void run() try InputStream is = s.getInputStream();ObjectInputStream ois = new ObjectInputStream(is);while (true) Object obj = ois.readObject();Message msg = (Message) obif (msg.msgType.equals(login) names.add(msg.from);String temp = + msg.from+ 上线了+ new SimpleDateFormat(yyyy-MM-dd hh:mm:ss)format(new Date();System.out.println(temp);msg.content = temp;msg.userList = names;sendMsg(msg); else if (msg.msgType.equals(chat) String temp = + msg.from+ :+ msg.content+ + new SimpleDateFormat(yyyy-MM-dd hh:mm:ss).format(new Date();System.out.println(temp);msg.content = temp;sendMsg(msg); else if (msg.msgType.equals(logout) String temp = + msg.from+ 下线了+ new SimpleDateFormat(yyyy-MM-dd hh:mm:ss)format(new Date();System.out.println(temp);msg.content = temp;sendMsg(msg); catch (Exception e) private void sendMsg(Message msg) /为每个客户端发送消息对象for(Object obj : sockets)try Socket s = (Socket)obj;ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream();oos.writeObject(msg);oos.flush(); catch (IOException e) / TODO Auto-generated catch block.start(); catch (IOException e) 23 主要成果 3总结3.1实习体会 来达内实习仅仅一个礼拜,来但收获听多的。之前觉得只不过只是走一个形式而已,所以就随便选了一个实习单位。渐渐的我的想法转变了很多。首先是达内的生活老师:有一种回到小时候的感觉,很亲切很舒服。累了会让我们睡一会,困了让我们歇歇,很负责很认真。代课老师循循善诱 讲课认真深入浅出,只是自己不太感兴趣。不过可能是夏天的原因吧,教室太堵了,闷的很。自己学了不少知识,觉得受益匪浅,首先从心态上有了转变,简单的说就是从一名学生到一个职业人的转变。无论在哪个工作岗位上,首先尽快适应工作环境,融入集体,赶上同事的步伐。其次,在熟练掌握各种业务知识的同时,不断注意学习,脚踏实地的做好每一份工作。积累实践经验。由于时间的关系,我们的这次实践课程老师并没有给我们详细的介绍,只是给我们简单的介绍了几个比较重要的实际操作。但是从这些课程中学到了不少学习软件的方法。现作如下概括首先将理论联系实际注重上机过程一个JAVA语言程序从编辑、编译、连接到运行,都要在一定的外部操作环境下才能进行。所谓环境就是所用的计算机系统硬件、软件条件,只有学会使用这些环境,才能进行程序开发工作。通过上机实验,熟练地掌握JAVA语言开发环境,为以后真正编写计算机程序解决实际问题打下基础。同时,在今后遇到其它开发环境时就会触类旁通,很快掌握

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论