Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaSocket¿Í»§¶ËÓëC·þÎñ¶ËͨÐÅ

ת×Ô£ºhttp://hi.baidu.com/ssrt_hanbing/blog/item/62e3b934598eeb82a71e1238.html
ͨ¹ý¸ßµÍλת»»¡£
package com.commnt;
import java.net.*;
import java.io.*;
public class Client {
public String send(String address, int port, String str) {
   OutputStream os = null;
   DataInputStream is = null;
   String look = "";
   Socket socket = null;
   try {
    socket = new Socket(address, port);
    os = socket.getOutputStream();
    byte[] phone = new byte[str.length()];
    phone = ByteUtil.StringtoBytes(phone, str);
    os.write(phone);
    os.flush();
    is = new DataInputStream(socket.getInputStream());
    byte[] phone1 = new byte[str.length()];
    is.read(phone1);
    String strBype = new String(phone1);
    look = strBype.toString();
   } catch (UnknownHostException e) {
    e.printStackTrace();
   } catch (IOException e) {
    e.printStackTrace();
   } finally {
    close(socket, is, os);
   }
   return look;
}
public void close(Socket socket, DataInputStream is, OutputStream os) {
   if (os != null)
    try {
     os.close();
    } catch (IOException e) {
     e.printStackTrace();
    }
   if (is != null)
    try {
     is.close();
    } catch (IOException e) {
     e.printStackTrace();
    }
   if (socket != null)
    try {
     socket.close();
    } catch (IOException e) {
     e.printStackTrace();
    }
}
}
public class ByteUtil


Ïà¹ØÎĵµ£º

C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨Î壩

µÚ¶þÕ Õ÷·þ¿É²âÐÔÄÑÌâ
 
2.1 ¿É²âÐÔÎÊÌâÏê½â£¨1£©
 
    µ¥Ôª²âÊÔÐ§ÒæÌØ±ð¸ß£¬·½·¨Ò²ºÜ¼òµ¥£¬µ«È´³¢ÊÔµÄÆóÒµºÜ¶à£¬³É¹¦ÊµÊ©µÄÆóÒµºÜÉÙ£¬ÎªÊ²Ã´ÄØ£¿Ö÷ÒªÔ­Òò¾ÍÊÇÄÑÓÚÍ»ÆÆ¿É²âÐÔÎÊÌâ¡£“¿É²â”Õâ¸ö´Ê£¬Òâ˼ÒѾ­ºÜÃ÷°×ÁË£¬Èç¹û²»“¿É²â”µÄ»°£¬ÄǾÍÊDz»Äܲ⣬û·¨²â£¬¾ÍÊÇ× ......

C³ÌÐò£ºÊ¹Óà googletest ²âÊÔ¿ò¼Ü

googletest C/C++ ²âÊÔ¿ò¼Ü·Ç³£ºÃÓ㬽éÉܼ°ÏÂÔØÇë¿´  http://code.google.com/p/googletest/
//============================================================================
// ʹÓà googletest ²âÊÔ¿ò¼Ü
//============================================================================

// Returns n! ......

C³ÌÐò£º´òÓ¡1,2,3,..,nµÄÈ«ÅÅÁÐ

/*
˼·£ºµÝ¹éËã·¨
ǰ0..cur-1λÖÃÉÏÒѾ­Åźã¬µ±Ç°curλÖÃȡһ¸öºÍÇ°Ãæ¶¼²»Ò»ÑùµÄ£¬È»ºóµÝ¹é´¦ÀíºóÃæµÄ¡£
*/
/* Êä³ö1,2,3,..,nµÄÅÅÁÐÊý */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
void p(int n)
{
extern void _p(int n, int cur, int *a);
int *a;
a = ......

C ÓïÑÔ¶þάÊý×éºÍË«ÖØÖ¸Õë

#include "Stdio.h"
#include "Conio.h"
#include
#define size 81
#define lim 5
#define tstr "ABCDEFGH"
void display(char **p,int i);
void display2(char *p[],int i);
void display3(char (*p)[40],int i);
void testint();
int main(void)
{
testint();
getch();
return 0;
}
test1() ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ