Addes some functionality to networkhandler, fixed wrong namespace
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WindowsFormsApplication2
|
||||
namespace MusicPlayer
|
||||
{
|
||||
class APIHandler
|
||||
{
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace WindowsFormsApplication2
|
||||
namespace MusicPlayer
|
||||
{
|
||||
class NetworkHandler
|
||||
{
|
||||
private int port = 8585;
|
||||
private Socket s;
|
||||
private APIHandler api;
|
||||
|
||||
public NetworkHandler(string ip)
|
||||
public NetworkHandler(string ip, APIHandler apihandler)
|
||||
{
|
||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
s.Connect(ip, port);
|
||||
api = apihandler;
|
||||
}
|
||||
|
||||
public void SendString(string m)
|
||||
@@ -25,7 +27,9 @@ namespace WindowsFormsApplication2
|
||||
while (s.Connected)
|
||||
{
|
||||
byte[] data = new byte[1024 * 200];
|
||||
int t = s.Receive(data);
|
||||
s.Receive(data);
|
||||
string message = Encoding.ASCII.GetString(data);
|
||||
System.Console.WriteLine(message);
|
||||
//Iets doen met api calls
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MusicPlayer
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
APIHandler a = new APIHandler;
|
||||
NetworkHandler nw = new NetworkHandler("imegumii.nl", a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user