# Help,How can I get FSocket working?

**URL:** <https://forums.unrealengine.com/t/help-how-can-i-get-fsocket-working/405180>\
**Category:** C++\
**Tags:** fsocket, unreal-engine, UE4, question, CPP\
**Created:** [September 22, 2017, 3:11am UTC](https://forums.unrealengine.com/t/help-how-can-i-get-fsocket-working/405180 "2017-09-22T03:11:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_8a9db2b8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8a9db2b8](https://forums.unrealengine.com/u/anonymous_user_8a9db2b8)\
**Post date:** [September 22, 2017, 3:11am UTC](https://forums.unrealengine.com/t/help-how-can-i-get-fsocket-working/405180/1 "2017-09-22T03:11:11Z")

</div>

**That’s my codes ：**

```
 include "MyPawn.h"
 include "Runtime/Engine/Classes/Camera/CameraComponent.h "
 include "Runtime/Sockets/Public/Sockets.h"
 include "Runtime/Sockets/Public/SocketSubsystem.h "
 FSocket* psocket;
 AMyPawn::AMyPawn() {
  PrimaryActorTick.bCanEverTick = true;
  AutoPossessPlayer = EAutoReceiveInput::Player0;
  
  psocket = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateSocket(NAME_Stream, TEXT("default"), false); // *********Compile success if without this line********
 }

```

**And that’s my erros ：**

> MyPawn.cpp.obj : error LNK2019:  
> ?޷???ⲿ??? "\_\_declspec(dllimport)  
> public: static class ISocketSubsystem
> 
> - \_\_cdecl ISocketSubsystem::Get(class FName const &)"  
> (\__imp_?Get@ISocketSubsystem@@SAPEAV1@AEBVFName@@@Z)???÷???ں???  
> “public: virtual void \_\_cdecl  
> AMyPawn::Tick(float)”  
> (?Tick@AMyPawn@@UEAAXM@Z) ?б???  
> D:\Unreal  
> Projects\HowTo\_PlayerInput\Binaries\Win64\UE4Editor-HowTo\_PlayerInput-3221.dll  
> : fatal error LNK1120: 1  
> ???޷???ⲿ???

**I’m a noob , thanks 4 u help !**

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8a9db2b8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8a9db2b8](https://forums.unrealengine.com/u/anonymous_user_8a9db2b8)\
**Post date:** [September 22, 2017, 4:01am UTC](https://forums.unrealengine.com/t/help-how-can-i-get-fsocket-working/405180/2 "2017-09-22T04:01:14Z")

</div>

> I fixed it .

> There is a file in ue4 project , It’s  
> name is ‘Project Name’.build.cs.

> add “Sockets” and “Networking” into it  
> . Then project can be compile successfully .
> 
> Like this ：

```
using UnrealBuildTool;

public class HowTo_PlayerInput : ModuleRules
{
	public HowTo_PlayerInput(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore",
                                                                                                    "Sockets",//new item
                                                                                                    "Networking"//new item
            });

		PrivateDependencyModuleNames.AddRange(new string[] { });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

```
