bonjour , j ai un probleme avec le proxy sans tarder voici le code source :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.*;
import java.net.*;
 
public class A {
 
	private static Socket socket;
	/**
         * @param args
         */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
 
 
		try{
			SocketAddress ad  = new InetSocketAddress("10.18.0.1", 80);// 1er param adresse du proxy 2 eme param port 80
			Proxy proxy = new Proxy(Proxy.Type.SOCKS,ad);
			socket  = new Socket(proxy);//init soket 1 ip 2 port
 
 
			InetSocketAddress remote = new InetSocketAddress("www.google.com",80);
			socket.connect(remote);
			System.out.println("SOCKET = " + socket);//voir le soket
			socket.close();
			} catch (Exception e) {
				e.printStackTrace();//pour soket
			} 		
 
			}
 
		}
et voici l erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at A.main(A.java:21)
j ai fait cela pour envoyer des requet http "POST" a la maison cela marche tres bien mais a la fac ya un proxy alors je ne peut pas connecter
l adresse du proxy est 10.18.0.1 le port utiliser 80
merci .