Arreglos IP local
parent
407d06bf00
commit
0f9a21eddc
|
|
@ -24,7 +24,7 @@ namespace OliviaAddIn
|
||||||
//devuelve -1 si no se ha podido crear socket
|
//devuelve -1 si no se ha podido crear socket
|
||||||
//0 si no se puede conectar
|
//0 si no se puede conectar
|
||||||
//1 si conectado
|
//1 si conectado
|
||||||
public bool conecta(string ip, int puerto)
|
public bool conecta(string ip, int puerto, string ip_local="")
|
||||||
{
|
{
|
||||||
termina();
|
termina();
|
||||||
try
|
try
|
||||||
|
|
@ -39,7 +39,7 @@ namespace OliviaAddIn
|
||||||
return false;
|
return false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return str_socket_conecta(sc, ip, puerto) != 0;
|
return str_socket_conecta(sc, ip, puerto, ip_local) != 0;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -120,7 +120,7 @@ namespace OliviaAddIn
|
||||||
unsafe public static extern IntPtr str_socket_crea();
|
unsafe public static extern IntPtr str_socket_crea();
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern int str_socket_conecta(IntPtr soc, String ip, int puerto);
|
unsafe public static extern int str_socket_conecta(IntPtr soc, String ip, int puerto, String ip_local=null);
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern int str_socket_envia(IntPtr soc, String txt);//solo este
|
unsafe public static extern int str_socket_envia(IntPtr soc, String txt);//solo este
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ namespace OliviaAddInPro.Model
|
||||||
|
|
||||||
public OliviaConf()
|
public OliviaConf()
|
||||||
{
|
{
|
||||||
Ip = "0.0.0.0";
|
Ip = "127.0.0.1";
|
||||||
Puerto = 19995;
|
Puerto = 19995;
|
||||||
TiempoOutSocket = 20;
|
TiempoOutSocket = 20;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -332,10 +332,11 @@ namespace OliviaAddInPro.Model
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] ips = OliviaGlob.dame_local_ips();
|
string[] ips = OliviaGlob.dame_local_ips();
|
||||||
if (ips != null && ips.Length > 0)
|
/*if (ips != null && ips.Length > 0)
|
||||||
Conexion.Ip = ips[0];
|
Conexion.Ip = ips[0];
|
||||||
else
|
else
|
||||||
Conexion.Ip = "127.0.0.1";
|
Conexion.Ip = "127.0.0.1";*/
|
||||||
|
Conexion.Ip = "127.0.0.1";
|
||||||
resp.Value = true;
|
resp.Value = true;
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,25 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{10742570-CF59-42F2-BEA2-2A38002A06EE}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ namespace OliviaAddInPro.Services
|
||||||
{
|
{
|
||||||
if (!conectado)
|
if (!conectado)
|
||||||
{
|
{
|
||||||
if (!soc.conecta(Ip, Puerto))
|
if (!soc.conecta(Ip, Puerto,Ip))
|
||||||
{
|
{
|
||||||
conectado = false;
|
conectado = false;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue